json-schema-org / json-schema-org/website

🐛 Bug: Homepage crashes when calendar (iCal) fetch fails , "Cannot read properties of undefined (reading 'map')

Open
#2,240 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🐛 Bug invalid Status: Triage
Dominant language
HTML
Stars
169
Forks
484
Avg merge
2d 2h
Merged PRs (30d)
6

Description

Describe the bug

The homepage can crash at build time or when loading if the Upcoming events data from the external Google Calendar iCal feed is missing or fails to load.

The page uses props.datesInfo.map(...) in the "Upcoming events" section. When the calendar URL is unreachable (network error, Google down, or parse failure), datesInfo is undefined. Calling .map() on it throws:

TypeError: Cannot read properties of undefined (reading 'map')

Steps To Reproduce
  1. Go to the homepage source: pages/index.page.tsx.
  2. In getStaticProps, temporarily force calendar data to be undefined (e.g. set const datesInfo = undefined; before the return, or point remoteICalUrl to an invalid URL so the fetch fails).
  3. Run the dev server (yarn dev or npm run dev) and open http://localhost:3000.
  4. See error: the page crashes with "Cannot read properties of undefined (reading 'map')" in the "Upcoming events" block (around line 549: props.datesInfo.map(...)).
Expected Behavior

If the calendar fetch fails or returns no events, the homepage should still load. The "Upcoming events" section should show an empty list (or a short message like "No upcoming events") instead of throwing.

Screenshots

No response

Device Information [optional]
- Browser: Chrome
Are you working on this issue?

Yes

Do you think this work might require an [Architectural Decision Record (ADR)]? (significant or noteworthy)

No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pages/index.page.tsx, especially getStaticProps and the Upcoming events block around line 549. Run the homepage with the calendar data unavailable using yarn dev or npm run dev, then verify the page loads without the map error and presents an empty or explanatory events state.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.