Skip to content

fix: handle calendar fetch failure and prevent UI crash#2367

Open
tusharv01 wants to merge 1 commit intojson-schema-org:mainfrom
tusharv01:fix-calendar-crash
Open

fix: handle calendar fetch failure and prevent UI crash#2367
tusharv01 wants to merge 1 commit intojson-schema-org:mainfrom
tusharv01:fix-calendar-crash

Conversation

@tusharv01
Copy link
Copy Markdown

@tusharv01 tusharv01 commented Mar 27, 2026

What kind of change does this PR introduce?

Bugfix

Issue Number:

Before: Homepage crashed due to undefined datesInfo
After: Website loads successfully with fallback handling

If relevant, did you update the documentation?

No

Summary

This PR fixes a crash on the homepage caused by failure to fetch the external Google Calendar.

This issue occurs when the external calendar API is unavailable (e.g., DNS failure, firewall blocking, or network issues). The fix ensures the app does not crash in such cases.

Previously:

  • If the calendar fetch failed, datesInfo became undefined
  • This caused a serialization error in getStaticProps
  • Additionally, the UI attempted to call .map() on a null/undefined value

Fix:

  • Added proper error handling to ensure datesInfo falls back to null
  • Updated UI rendering to safely handle null values using optional chaining

Impact:

  • Prevents runtime crash when external API is unavailable
  • Improves resilience and stability of the homepage

Does this PR introduce a breaking change?

No

Checklist

  • Read, understood, and followed the contributing guidelines

@tusharv01 tusharv01 requested a review from a team as a code owner March 27, 2026 10:44
@github-project-automation github-project-automation bot moved this to Ready to review in PR - Triage Group Mar 27, 2026
@github-actions
Copy link
Copy Markdown

Hi @tusharv01! Thanks a lot for your contribution!

I noticed that the following required information is missing or incomplete: issue reference

Please update the PR description to include this information. You can find placeholders in the PR template for these items.

Thanks a lot!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 27, 2026

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
website ✅ Ready (View Log) Visit Preview ef197cd

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (5ca1483) to head (ef197cd).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2367   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           30        30           
  Lines          672       672           
  Branches       211       211           
=========================================
  Hits           672       672           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

Hi @tusharv01! Thanks a lot for your contribution!

I noticed that the following required information is missing or incomplete: issue reference

Please update the PR description to include this information. You can find placeholders in the PR template for these items.

Thanks a lot!

1 similar comment
@github-actions
Copy link
Copy Markdown

Hi @tusharv01! Thanks a lot for your contribution!

I noticed that the following required information is missing or incomplete: issue reference

Please update the PR description to include this information. You can find placeholders in the PR template for these items.

Thanks a lot!

Copy link
Copy Markdown
Contributor

@Tushar8466 Tushar8466 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix! This change improves stability by handling calendar fetch failures and preventing a potential UI crash 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready to review

Development

Successfully merging this pull request may close these issues.

🐛 Bug: Homepage crashes when calendar fetch fails

2 participants