-
Notifications
You must be signed in to change notification settings - Fork 102
Commit e837256
Add mutations guide (#614)
* Add WIP version of mutations guide
* add before/after example
* docs: clean up mutation handler examples
- Pull mutation off mutations array for cleaner code
- Add comment explaining collection handlers only receive one mutation at a time
- Apply pattern consistently across all handler examples
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* docs: remove pioneer analogy
* docs: fix mutation handler patterns
- Remove incorrect comment about single mutations
- Update handlers to use Promise.all for multiple mutations
- Fix collection.refetch() -> collection.utils.refetch()
- Update Electric collection pattern to return txids
- Add note about automatic refetch in collection handlers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* docs: fix temporary ID generator bug
Parenthesize the offset to ensure negative IDs: -(Math.floor(...) + 1)
Previously could produce positive 1 when Math.random() returns 0
* docs: clarify Immer-like pattern usage
Use 'Immer-like pattern' instead of 'uses Immer under the hood'
* docs: fix operation handler signatures
- Correct handler params to { transaction, collection }
- Remove incorrect metadata parameter from signature
- Add metadata to mutation object properties list
- Fix return type to Promise<any> | any
* docs: clarify handler sync requirements
Replace QueryCollection-specific note with general requirement that handlers
must wait for server changes to sync back before resolving
* docs: remove unnecessary refetch call in generic mutation function
Collection handlers automatically handle refetch, only custom actions need it
* docs: clarify commit timing with example
* docs: fix TransactionConfig options
- Make mutationFn required (not optional)
- Add missing id and metadata options
- Mark autoCommit as optional
* docs: clarify when to manually rollback transactions
Note that rollback is automatic on error, manual rollback only needed
for user actions like canceling a form
* docs: streamline mutation merging section
- Replace opening paragraph with bullet points
- Remove worked examples, keep truth table only
- Remove redundant benefits list
* Add an example.
---------
Co-authored-by: Claude <[email protected]>1 parent 5b58da9 commit e837256Copy full SHA for e837256
File tree
Expand file treeCollapse file tree
2 files changed
+1028
-386
lines changedFilter options
- docs
- guides
Expand file treeCollapse file tree
2 files changed
+1028
-386
lines changed
0 commit comments