Skip to content

fix: guard root loader data in page view tracker and isolate live config failures - #1491

Merged
tannerlinsley merged 2 commits into
mainfrom
seer/fix/page-view-tracker-loader-guard
Nov 5, 2026
Merged

tannerlinsley merged 2 commits into
mainfrom
seer/fix/page-view-tracker-loader-guard

Conversation

@sentry

@sentry sentry Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Root Cause

PageViewTracker runs directly inside the root shellComponent. TanStack Router mounts shellComponent even when the root loader fails or is still pending (because the shell also wraps the route's errorComponent).

Previously, PageViewTracker immediately destructured { live } = Route.useLoaderData(). When the root loader had no resolved data (such as when getLiveRuntimeConfig() threw or timed out during server function evaluation), Route.useLoaderData() returned undefined, causing an uncaught TypeError: Cannot destructure property 'live' of 'ue.useLoaderData(...)' as it is undefined that crashed the entire application.

Fix

  1. Guard Route.useLoaderData() in PageViewTracker (src/routes/__root.tsx): Safely access Route.useLoaderData()?.live and derive boolean flags (live?.presenceEnabled === true, live?.chatEnabled === true). This ensures core page view analytics and Scarf interaction listeners continue to work even when root loader data is unavailable.
  2. Isolate optional live runtime config in root loader: Wrapped getLiveRuntimeConfig() in a helper that catches failures, logs them via Sentry.captureException(error, { tags: { feature: 'live-config' } }), and falls back to disabling presence and chat features so that failures in non-critical live configuration never break the root route or send the entire site into an error boundary.

Fixes TANSTACK-COM-5F7

@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 5, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d19fbf2

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 5, 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: d046ba1f-7426-4329-8a12-4b72f58d6ac9

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

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 d19fbf2 Commit Preview URL

Branch Preview URL
Nov 05 2026, 11:17 AM

@tannerlinsley
tannerlinsley merged commit 96e67a4 into main Nov 5, 2026
8 checks passed
@tannerlinsley
tannerlinsley deleted the seer/fix/page-view-tracker-loader-guard branch November 5, 2026 11:35
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