Skip to content

fix(charts): Guard against undefined loader data in ChartsCatalogCaseRoute - #1285

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/charts-loader-data-guard
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/charts-loader-data-guard

Conversation

@sentry

@sentry sentry Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a TypeError: undefined is not an object (evaluating 'e.useLoaderData().case') that occurred in ChartsCatalogCaseRoute.

The root cause was that ChartsCatalogCaseRoute unconditionally accessed data.case from Route.useLoaderData(). During navigation between $caseId parameters (e.g., 40-geojson-map39-density-contours), TanStack Router can render the component before the new loader resolves, causing useLoaderData() to return undefined.

The fix adds a null guard (if (!data) return null) to ChartsCatalogCaseRoute in src/routes/_library/charts.catalog.charts.$caseId.tsx. This prevents accessing data.case when data is undefined, aligning with the defensive check already present in the route's head() function and ensuring the component gracefully handles pending loader data.

Fixes TANSTACK-COM-4RJ

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 271cf019-6fda-4606-b80d-32bf55965f66

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com 2984a77 Commit Preview URL

Branch Preview URL
Sep 21 2026, 11:04 AM

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants