Repository navigation
fix(supabase): subscribe to changes in the table's schema - #1035
Merged
Merged
Conversation
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.
Summary
client.From<T>().On(...)listened to changes inpublicwhatever the table's schema, so a table outsidepublic([Table(Schema = ...)], a client fromWithSchema, orSupabaseOptions.Schema) was subscribed to the wrong topic and Realtime refused the join. The table now listens in the schema its requests target, which a table also reports through a newIPostgrestTable<TModel>.Schema.Public API
Behavior
IPostgrestTable<TModel>.Schemais the schema every request on the table targets: the schema of a client fromWithSchema, otherwiseTableAttribute.Schema, otherwiseClientOptions.Schema(feat(postgrest): query a table in the schema its model declares #1030).SupabaseTable.Onopensrealtime:{Schema}:{table}.Client.From<T>()andStatelessClient.From<T>()build the table with the new constructor; the stateless one previously passedSupabaseOptions.Schema, which ignored a model's own schema.SupabaseTable(postgrestClient, realtimeClient, string schema = "public")keeps its meaning for a caller that passes a schema: listen there. A caller that passed two arguments binds to the new constructor once recompiled; binaries built against the old one keeppublicuntil then.Deviations from supabase-js
None in behavior: supabase-js subscribes to changes per channel, with the schema the caller names. The model-typed
From<T>().Onis C#-only.Tests
TableChangesTestspersonal.usersthroughFrom<PersonalUser>().OnTableChangesChannelTestsWithSchemaclient, the client schema and an explicit schema; bothFrompaths build a table in its own schemaResolvedSchemaTests(Postgrest)Schemafor each precedence caseBefore the fix, the E2E test failed with Realtime refusing
realtime:public:users("Unable to subscribe to changes with given parameters … schema: public, table: users"), and three of the unit tests failed on the channel schema;Schemadid not exist onIPostgrestTable.Diff coverage: 100% (Postgrest 1 line, Supabase 4 lines). Mutation: Postgrest's changed line has no mutant; Supabase 2 killed of 2 tested on changed lines, 0 survivors.
Notes
supabase/migrations/1751173800_realtime_personal_users.sqladdspersonal.usersto thesupabase_realtimepublication with full replica identity.BEGIN_COMMIT_OVERRIDE
feat(postgrest): report the schema a table's requests target
fix(supabase): subscribe to changes in the table's schema
END_COMMIT_OVERRIDE