fix(realtime): suppress disconnected status from onHeartbeat consumers - #2496
Merged
Merged
Conversation
@supabase/auth-js
@supabase/functions-js
@supabase/postgrest-js
@supabase/realtime-js
@supabase/storage-js
@supabase/supabase-js
commit: |
mandarini
force-pushed
the
fix/realtime-suppress-disconnected-heartbeat
branch
from
July 6, 2026 12:36
6e111df to
a81ad7d
Compare
mandarini
marked this pull request as ready for review
July 6, 2026 13:24
mandarini
force-pushed
the
fix/realtime-suppress-disconnected-heartbeat
branch
from
July 6, 2026 13:53
a81ad7d to
94c0772
Compare
spydon
approved these changes
Jul 6, 2026
This was referenced Jul 7, 2026
mandarini
pushed a commit
to supabase/ssr
that referenced
this pull request
Jul 7, 2026
This PR updates `@supabase/supabase-js` to v2.110.1. **Source**: supabase-js-stable-release --- ## Release Notes ## v2.110.1 ## 2.110.1 (2026-07-07) ### 🩹 Fixes - **auth:** defer init-time notifications until initializePromise resolves ([#2498](supabase/supabase-js#2498)) - **realtime:** suppress disconnected status from onHeartbeat consumers ([#2496](supabase/supabase-js#2496)) ### ❤️ Thank You - Katerina Skroumpelou @mandarini This PR was created automatically. Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini
pushed a commit
to supabase/supabase
that referenced
this pull request
Jul 7, 2026
This PR updates @supabase/*-js libraries to version 2.110.1. **Source**: supabase-js-stable-release **Changes**: - Updated @supabase/supabase-js to 2.110.1 - Updated @supabase/auth-js to 2.110.1 - Updated @supabase/realtime-js to 2.110.1 - Updated @supabase/postgest-js to 2.110.1 - Refreshed pnpm-lock.yaml --- ## Release Notes ## v2.110.1 ## 2.110.1 (2026-07-07) ### 🩹 Fixes - **auth:** defer init-time notifications until initializePromise resolves ([#2498](supabase/supabase-js#2498)) - **realtime:** suppress disconnected status from onHeartbeat consumers ([#2496](supabase/supabase-js#2496)) ### ❤️ Thank You - Katerina Skroumpelou @mandarini ## v2.110.0 ## 2.110.0 (2026-06-30) ### 🚀 Features - **repo:** drop Node.js 20 support ([#2482](supabase/supabase-js#2482)) ### ❤️ Thank You - Katerina Skroumpelou @mandarini ## v2.109.0 ## 2.109.0 (2026-06-30) ### 🚀 Features - **auth:** add custom_claims_allowlist to custom providers admin API ([#2473](supabase/supabase-js#2473)) - **realtime:** add postgres_changes filter builder, new operators and select ([#2463](supabase/supabase-js#2463)) - **storage:** expose purgeCache for buckets and single objects ([#2429](supabase/supabase-js#2429)) ### 🩹 Fixes - **functions:** honor a caller's Content-Type override regardless of casing ([#2455](supabase/supabase-js#2455)) - **realtime:** pin @supabase/phoenix and browser test CDN deps ([#2457](supabase/supabase-js#2457)) - **realtime:** add replication connection system message option ([#2470](supabase/supabase-js#2470)) - **storage:** keep sortBy defaults when list() is given a partial sortBy ([#2454](supabase/supabase-js#2454)) ### ❤️ Thank You - Anubhav Anand @i-anubhav-anand - Cemal Kılıç @cemalkilic - Claude Opus 4.8 (1M context) - Filipe Cabaço @filipecabaco - Katerina Skroumpelou @mandarini - Lenny - Rodrigo Mansueli @mansueli This PR was created automatically. Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
What changed?
_wrapHeartbeatCallbackinRealtimeClientnow silently drops any heartbeat status of'disconnected'before forwarding to the consumer callbackdisconnectedfrom theonHeartbeatJSDoc example statusesWhy was this change needed?
onHeartbeatexposes a'disconnected'status viaHeartbeatStatus, but it fires nondeterministically. The emission comes from@supabase/phoenix'sSocket.sendHeartbeat()as a race-condition safeguard: if the heartbeat timer fires after the connection closes but beforeclearHeartbeats()runs inonConnClose, the!isConnected()guard emits'disconnected'. Whether a consumer's callback ever receives it depends entirely on OS scheduler timing.Connection lifecycle signals belong to the close handler and state-change events, not the heartbeat path. Consumers relying on
'disconnected'fromonHeartbeatcannot do so reliably.Closes #2488
Screenshots/Examples
Before: consumers could receive
'disconnected'fromonHeartbeatintermittently with no way to depend on it.After:
onHeartbeatonly fires'sent','ok','error', and'timeout'-- all deterministic heartbeat lifecycle statuses. Use socket state-change events (onOpen,onClose,onError) for connection lifecycle.Breaking changes
HeartbeatStatusstill includes'disconnected'in the type union -- no type surface is removed. The only observable change is that the nondeterministic emission is swallowed before reaching any consumer. A follow-up breaking change to remove'disconnected'fromHeartbeatStatusentirely is tracked for v3.Checklist
<type>(<scope>): <description>pnpm nx formatto ensure consistent code formattingAdditional notes
The root-cause fix (removing the
heartbeatCallback("disconnected")emission from@supabase/phoenix'ssendHeartbeat()). Once that ships, the suppression guard added here can be removed as dead code.