File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @tanstack/db " : patch
3+ ---
4+
5+ If collection.update is called and nothing is changed, return a transaction instead of throwing
Original file line number Diff line number Diff line change @@ -1043,9 +1043,13 @@ export class CollectionImpl<
10431043 } )
10441044 . filter ( Boolean ) as Array < PendingMutation < T > >
10451045
1046- // If no changes were made, return early
1046+ // If no changes were made, return an empty transaction early
10471047 if ( mutations . length === 0 ) {
1048- throw new Error ( `No changes were made to any of the objects` )
1048+ const emptyTransaction = new Transaction ( {
1049+ mutationFn : async ( ) => { } ,
1050+ } )
1051+ emptyTransaction . commit ( )
1052+ return emptyTransaction
10491053 }
10501054
10511055 // If an ambient transaction exists, use it
You can’t perform that action at this time.
0 commit comments