website icon indicating copy to clipboard operation
website copied to clipboard

Fix critical runtime crashes: handle empty blog posts and calendar fetch failures

Open inland-taipen opened this issue 1 month ago • 5 comments

What we did

Fixed two runtime crash bugs in the JSON Schema website:

Bug #1: Homepage crash when blogPosts is empty Problem: Accessing blogPosts[0] without checking if the array was empty caused crashes.

Solution: Added null/empty checks: const blogPosts = props.blogPosts || [] Introduced firstBlogPost variable with safe access Wrapped blog post section in conditional rendering: {firstBlogPost && (...)} Added fallback for reading time calculation

Bug #2: Homepage crash when calendar fetch fails Problem: Calendar fetch errors left datesInfo as undefined, causing .map() to crash.

Solution: Replaced .catch() that didn't return a value with a try-catch block Defaulted datesInfo to empty array [] on error Added TypeScript type annotations for datesInfo Added safe array access: (props.datesInfo || []).map(...)

Files modified pages/index.page.tsx — Homepage fixes pages/community/index.page.tsx — Community page fixes

inland-taipen avatar Nov 15 '25 19:11 inland-taipen

Hi @inland-taipen! Thanks a lot for your contribution!

I noticed that the following required information is missing or incomplete: issue reference, kind of change description

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[bot] avatar Nov 15 '25 19:11 github-actions[bot]

Hi @inland-taipen! Thanks a lot for your contribution!

I noticed that the following required information is missing or incomplete: issue reference, kind of change description

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[bot] avatar Nov 15 '25 19:11 github-actions[bot]

Hii @inland-taipen, can you please mention which issue this PR points out, Do not open PRs without proper issue listing and assignment, will help maintainers to organise codebase effectively. Thanks

vtushar06 avatar Nov 16 '25 09:11 vtushar06

hi @inland-taipen I checked your code there is problem in this file 'pages/community/index.page.tsx' from 369 to 378 line they are expecting 2 more space (indentation issue). it will solve the code quality issue.

and in description add the issue number you solved

Bhumikagarggg avatar Nov 16 '25 16:11 Bhumikagarggg

Bug 1: Homepage crash when blogPosts is empty

blogPosts will never be empty. Please consider the whether the changes you're proposing are practical and solving a real problem.

jdesrosiers avatar Nov 17 '25 19:11 jdesrosiers