Expose the original streamOptions in getSyncMetadata?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.9k
- Forks
- 266
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 55
Description
The ElectricCollection exposes primary key and relation in its sync metadata, set from the streamOptions: https://github.com/TanStack/db/blob/1c318955d7fff533988663863701c95896c3b7ea/packages/db-collections/src/electric.ts#L128
This was originally done / intended to be used for inserts. However, it’s also a way to introspect the collection for other purposes.
Such as knowing which shape defn the collection came from when doing a backend framework integration with a generic mutationFn. (As per private conv here https://discord.com/channels/933657521581858818/1373729505033846794/1373735592915107850).
Would there be any downside to extending the exposed sync metadata with the original streamOptions?
In some cases the shape params can be non-tiny, eg if they contain a fairly long list of IDs or where clauses or some such. But never bigger than a valid query string, so probably not a big deal?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/db-collections/src/electric.ts around the linked sync metadata code and trace getSyncMetadata back to the streamOptions input. Confirm how the original options are currently transformed, then verify that the returned metadata includes them, including larger shape parameters, without changing the existing primary-key or relation metadata.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- database
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100