Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
inland-taipen wants to merge1 commit intojson-schema-org:main
base:main
Choose a base branch
Loading
frominland-taipen:main

Conversation

@inland-taipen
Copy link

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

@github-actions
Copy link

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!

Issue: Runtime crashes when blogPosts array is empty or calendar fetch failsKind of change: Bug fix (fixes runtime crashes)Description:- Add null checks for blogPosts array before accessing first element- Add safe array access with fallback to empty array for datesInfo- Add proper error handling with try-catch for calendar data fetching- Add TypeScript type annotations for datesInfo to prevent type errors- Wrap blog post section in conditional rendering to prevent crashes- Both homepage and community page now handle empty data gracefullyFiles modified:- pages/index.page.tsx- pages/community/index.page.tsx
@github-actions
Copy link

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!

@vtushar06
Copy link
Contributor

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

@Bhumikagarggg
Copy link
Contributor

Bhumikagarggg commentedNov 16, 2025
edited
Loading

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

@jdesrosiers
Copy link
Member

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.

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

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

Status: Ready to review

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@inland-taipen@vtushar06@Bhumikagarggg@jdesrosiers

[8]ページ先頭

©2009-2025 Movatter.jp