Skip to content

fix: fall back to keepalive fetch when navigator.sendBeacon is unavailable - #1495

Merged
tannerlinsley merged 1 commit into
mainfrom
seer/fix-live-presence-sendbeacon-fallback
Nov 9, 2026
Merged

tannerlinsley merged 1 commit into
mainfrom
seer/fix-live-presence-sendbeacon-fallback

Conversation

@sentry

@sentry sentry Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Fixes an unhandled TypeError: navigator.sendBeacon is not a function error occurring on pagehide in environments where navigator.sendBeacon is undefined (such as Apple Mail WebViews or privacy-hardened Firefox configurations with beacon.enabled=false).

Changes

  • In src/utils/analytics/live-browser.ts, update sendLeave to check whether navigator.sendBeacon is a function before calling it.
  • If sendBeacon is not available, fall back to posting the leave payload using fetch('/_a/live', { keepalive: true, ... }) to ensure the presence leave event is still sent without throwing an error.
  • Reset wasOnPublicPage immediately to prevent duplicate leave requests across consecutive calls.
  • Add a unit test in tests/live-presence.test.ts to verify leave dispatch works cleanly via fetch when sendBeacon is missing.

Fixes TANSTACK-COM-55J

@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 8, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 633315d

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 8, 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: 1b38ca4e-aa1b-4290-a5c0-544c4e016dc1

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 633315d Commit Preview URL

Branch Preview URL
Nov 08 2026, 11:05 PM

@tannerlinsley
tannerlinsley merged commit 1da10c1 into main Nov 9, 2026
8 checks passed
@tannerlinsley
tannerlinsley deleted the seer/fix-live-presence-sendbeacon-fallback branch November 9, 2026 04:43
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