Repository navigation
fix(realtime): preserve presence refs - #2566
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
Walkthrough
Assessment against linked issues
Possibly related PRs
Suggested labels: Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: lockfile failed supply-chain policy check. Run 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. Comment |
@supabase/auth-js
@supabase/functions-js
@supabase/postgrest-js
@supabase/realtime-js
@supabase/storage-js
@supabase/supabase-js
commit: |
mandarini
left a comment
There was a problem hiding this comment.
One small thing before I merge. Can we please add a test for the presence update path? Your test covers two devices under one key. The more common trigger is a single client calling track() again with a changed payload: the server responds with Phoenix.Presence.update (presence_handler.ex L162-163), which sends a join and a leave for the same key in a single diff. That shape duplicates the member immediately with the stale payload still visible, and then both metas ghost on disconnect. It is a different symptom from the one you assert on, so it needs its own case:
test('collapses a presence update instead of duplicating the member', () => {
const key = 'user-123'
let state: PresenceStates = { [key]: { metas: [{ phx_ref: 'r1', status: 'online' }] } }
// track() with a changed payload: the server sends Presence.update as join + leave
state = Presence.syncDiff(
state,
{
joins: { [key]: { metas: [{ phx_ref: 'r2', phx_ref_prev: 'r1', status: 'away' }] } },
leaves: { [key]: { metas: [{ phx_ref: 'r1', status: 'online' }] } },
},
PresenceAdapter.onJoinPayload,
PresenceAdapter.onLeavePayload
)
expect(state[key].metas).toHaveLength(1)
state = Presence.syncDiff(
state,
{ joins: {}, leaves: { [key]: { metas: [{ phx_ref: 'r2', status: 'away' }] } } },
PresenceAdapter.onJoinPayload,
PresenceAdapter.onLeavePayload
)
expect(state).not.toHaveProperty(key)
})toHaveLength(1) is 2 without your change and 1 with it, so it earns its place.
This PR updates @supabase/*-js libraries to version 2.110.9. **Source**: supabase-js-stable-release **Changes**: - Updated @supabase/supabase-js to 2.110.9 - Updated @supabase/auth-js to 2.110.9 - Updated @supabase/realtime-js to 2.110.9 - Updated @supabase/postgest-js to 2.110.9 - Refreshed pnpm-lock.yaml --- ## Release Notes ## v2.110.9 ## 2.110.9 (2026-07-27) ### 🩹 Fixes - **auth:** downgrade stale refresh token console noise ([#2559](supabase/supabase-js#2559)) - **realtime:** preserve presence refs ([#2566](supabase/supabase-js#2566)) - **repo:** override sharp to >=0.35.0 to clear libvips advisory ([#2548](supabase/supabase-js#2548)) - **repo:** populate symbols in sdk-compliance so capabilities are verifiable ([#2547](supabase/supabase-js#2547)) - **repo:** bump postcss, babel, next to clear audit advisories ([#2561](supabase/supabase-js#2561)) ### ❤️ Thank You - Katerina Skroumpelou @mandarini - Vaibhav @7ttp This PR was created automatically. Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
This PR updates `@supabase/supabase-js` to v2.110.9. **Source**: supabase-js-stable-release --- ## Release Notes ## v2.110.9 ## 2.110.9 (2026-07-27) ### 🩹 Fixes - **auth:** downgrade stale refresh token console noise ([#2559](supabase/supabase-js#2559)) - **realtime:** preserve presence refs ([#2566](supabase/supabase-js#2566)) - **repo:** override sharp to >=0.35.0 to clear libvips advisory ([#2548](supabase/supabase-js#2548)) - **repo:** populate symbols in sdk-compliance so capabilities are verifiable ([#2547](supabase/supabase-js#2547)) - **repo:** bump postcss, babel, next to clear audit advisories ([#2561](supabase/supabase-js#2561)) ### ❤️ Thank You - Katerina Skroumpelou @mandarini - Vaibhav @7ttp This PR was created automatically. Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
TL;DR
Build presence event payloads from copies so live presence refs remain intact and
departed members are removed correctly.
ref: