Skip to content

fix(realtime)!: fail presence track and untrack while the channel is not joined - #2203

Merged
spydon merged 2 commits into
mainfrom
lukasklingsbo/sdk-3201-presence-track-not-joined
Nov 30, 2026
Merged

spydon merged 2 commits into
mainfrom
lukasklingsbo/sdk-3201-presence-track-not-joined

Conversation

@spydon

@spydon spydon commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

track() and untrack() now resolve with ChannelResponse.error without sending anything while the channel is not joined, instead of buffering the message until the join.

  • Matches the track spec: a buffered presence message could time out and still reach the server after the rejoin.
  • Adds a MIGRATION.md section.

SDK-3201

Summary by CodeRabbit

  • Bug Fixes
    • Presence updates sent before a channel is joined, including during rejoining, now return an error instead of being buffered or sent. Track presence again after the channel successfully subscribes.
  • Documentation
    • Updated the migration guide and API documentation with the presence update behavior and an example that waits for subscription before tracking.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Presence updates now return ChannelResponse.error when the channel is not joined. The migration guide and tests describe behavior before subscription, during joining, and after a successful join.

Changes: Presence tracking behavior

Layer / File(s) Summary
Reject presence updates while not joined
packages/supabase_realtime/lib/src/realtime_channel.dart, packages/supabase_realtime/test/channel_test.dart, MIGRATION.md
send returns an error without sending a presence message when the channel is not joined. Tests cover calls before subscription, during joining, and after joining. The migration guide documents the behavior and shows tracking after the channel reports subscribed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested labels: realtime

Merge Risk: Minimal · up to 52ad0

Presence track and untrack calls made while a channel is not joined now return an error and send nothing, instead of being buffered until the join. The change is documented in the migration guide and covered by new tests. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: presence track() and untrack() now fail with ChannelResponse.error while the channel is not joined. The raw summary confirms this: calls made before join now resolve w…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: presence track() and untrack() now fail with ChannelResponse.error while the channel is not joined. The raw summary confirms this: calls made before join now resolve with an error and send nothing, and send() rejects presence messages when canPush is false. The title uses the conventional fix(realtime)! prefix, and the ! marks a breaking behavior change, which matches the MIGRATION.md update. The title is specific and does not need to list the test or doc changes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between cb3e12d and 52ad06f.

Files selected for processing: 3

  • MIGRATION.md
  • packages/supabase_realtime/lib/src/realtime_channel.dart
  • packages/supabase_realtime/test/channel_test.dart

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@spydon
spydon force-pushed the lukasklingsbo/sdk-3201-presence-track-not-joined branch from 6f33b7d to 52ad06f Compare November 30, 2026 14:08
@spydon
spydon merged commit 6edcce8 into main Nov 30, 2026
60 checks passed
@spydon
spydon deleted the lukasklingsbo/sdk-3201-presence-track-not-joined branch November 30, 2026 14:14
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