feat: Add a header to all PostgREST API calls - #14
Merged
Conversation
saltcod
approved these changes
Aug 28, 2026
The aggregate/groupBy branch of `queryOnce` builds its PostgREST request via `buildSupabaseQuery`, which is a separate `.setHeader()` call site from `supabaseQueryFn`. The existing header test used a non-aggregate query, so it exercised `queryOnceBase` and left that call site uncovered — removing the header there kept the suite green. Also pin two behaviours the header docs claim but nothing asserted: the library value replaces supabase-js's own `X-Client-Info` instead of appending to it, and user-supplied `global.headers` survive alongside it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ivasilov
force-pushed
the
feat/header-version
branch
from
September 6, 2026 19:38
448971f to
2ef5ccc
Compare
The postgres_changes handler called writeInsert for INSERT and writeUpdate for UPDATE. Both throw when the collection's state does not match the event: writeInsert raises DuplicateKeySyncError when the key is already present with different data, and writeUpdate raises UpdateOperationItemNotFoundError when the key is absent. Because these run inside a WebSocket callback, neither is catchable by application code — they surface as unhandled errors that take down the run. That is not just a test artifact: an INSERT event routinely races the initial PostgREST fetch, and a channel can replay events after a reconnect. The e2e suite hit it because a truncate-and-reseed republished a seeded row into a collection that still held the previous value. writeUpsert dispatches on key presence and throws in neither direction, and payload.new is the complete post-change row for INSERT and UPDATE alike, so it is correct for both. It is available in @tanstack/query-db-collection 1.0.0, the declared floor, so no dependency bump is needed. DELETE already guarded with collection.has(). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ivasilov
force-pushed
the
feat/header-version
branch
from
September 6, 2026 20:23
031b3d9 to
d79d5c2
Compare
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.
No description provided.