Skip to content

fix: guard docs routes against undefined loader data - #1530

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix-docs-loader-destructure-crash-9aBQou
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix-docs-loader-destructure-crash-9aBQou

Conversation

@sentry

@sentry sentry Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Fixes TypeError: Cannot destructure property 'content' from null or undefined value when navigating between docs versions (e.g. from /table/v8/docs/introduction to /table/latest/docs/introduction).

When a navigation commits while an intent preload or loader fetch is still in flight, TanStack Router renders the route match before its loader resolves. Destructuring Route.useLoaderData() directly in the route component threw a TypeError.

Changes:

  • Add DocsPending component that renders a spinner inside DocContainer.
  • In src/routes/_library/$libraryId/$version.docs.$.tsx, guard Route.useLoaderData() before destructuring and render <DocsPending /> when loaderData is undefined.
  • Apply the same guard and fallback in src/routes/_library/$libraryId/$version.docs.framework.$framework.$.tsx.

Fixes TANSTACK-COM-5H3

@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.

@changeset-bot

changeset-bot Bot commented Nov 22, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2ab5aa4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

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

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b42060d5-b456-408a-8b9a-e286150a1ed8

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 22, 2026 •

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 2ab5aa4 Commit Preview URL

Branch Preview URL
Nov 22 2026, 11:11 AM

@tannerlinsley

Copy link
Copy Markdown
Member

I'd keep this open until we can show the version switch recovering to usable docs. The spinner avoids the destructuring exception, but that alone doesn't establish that loader data will arrive after this match renders.

AI review notes: I reviewed head 2ab5aa45. The non-framework loader awaits loadDocsRoute, then returns a document or throws a redirect/not-found. The PR's explanation that an in-flight preload commits early needs a reproduction against the installed Router version. Please add a regression for the reported /table/v8/docs/introduction to /table/latest/docs/introduction navigation that fails before the fix and reaches the expected document afterward, including a failed-load case that reaches an error state instead of staying on the spinner. This overlaps the recovery question in #1508. I have not reproduced the incident or accessed the private Sentry event.

This branch has not been deployed

No deployments
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.

1 participant