Skip to content

parity(realtime): block setting postgres_changes listener after channel joins [from supabase-js] #242

Closed

Description

@grdsdev

Warning

Auto-generated by AI — This issue was automatically created by an AI-based SDK parity analysis tool. It may not be applicable to this SDK or may already be implemented in a different form. Please use your best judgment before accepting or closing this issue.

SDK Parity: C# implementation needed

A change was made in supabase-js that needs to be implemented in this repository for SDK parity.

Reference Implementation (supabase-js)

What Changed

Previously only presence callbacks were blocked after channel join. Now postgres_changes listeners also throw an error if added after the channel has joined or is in the process of joining.

Code Reference

// Before: only presence was blocked
if (this.channelAdapter.isJoined() && type === REALTIME_LISTEN_TYPES.PRESENCE) {
  throw new Error('cannot add presence callbacks after joining a channel')
}

// After: both presence AND postgres_changes are blocked
const stateCheck = this.channelAdapter.isJoined() || this.channelAdapter.isJoining()
if (stateCheck && (type === REALTIME_LISTEN_TYPES.PRESENCE || type === REALTIME_LISTEN_TYPES.POSTGRES_CHANGES)) {
  throw new Error(`cannot add ${type} callbacks after joining a channel`)
}

Implementation Guidance

Expected Behavior (C#)

// Should throw when channel is already subscribed
channel.Register(new PostgresChangesOptions { ... }); // throws if already subscribed

Key Behaviors to Match

  • Throws when trying to register PostgresChanges listener after channel joined
  • Also blocks during "subscribing" state (not just subscribed)
  • Clear error message indicating the constraint
  • Presence behavior unchanged (already blocked in most implementations)

Acceptance Criteria

  • Register(PostgresChangesOptions) throws after channel subscribe
  • Also throws during subscribing state
  • Clear InvalidOperationException (or similar) with helpful message
  • Unit test covering post-subscribe listener registration
  • No breaking change for properly-ordered usage

Context

  • supabase-js version: v2.101.0
  • Parity tracking: This issue was auto-generated by SDK parity analysis

Generated with Claude Code /sync-sdk-parity

Activity

  1. self-assigned this
    on Jul 1, 2026
  2. Tr00d commented on Sep 10, 2026

    @Tr00d
    Contributor

    Fixed with #385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions