Skip to content
Source
Sign inSign up
TanStack/db

query collection optimistic updates incorrectly rollback with updating non-primitive values #902

Send to my agent
Closedwillhoney7(GitHub profile, opens in a new tab) opened this issue 0 comments
  • I've validated the bug against the latest version of DB packages

Describe the bug I reported #814 which was fixed, but I'm noticing a new issue. If I create a field that is an object (i.e., a non-primitive) and update that, the optimistic write will get rolled back every other update. It's easier to see in the codesandbox.

To Reproduce Codesandbox: https://codesandbox.io/p/sandbox/tanstack-db-bug-2-7txp3s

Click on the "update metadata" button on the first todo. It will work correctly. Click it again, and you'll notice that it's instantly correct, but after the "server" update finishes it will rollback to the previous state.

Expected behavior I would expect that the update made to the object would stick around and not rollback to the previous value.

Additional context Some notes:

  • the bug does not occur when setting refetch: true
  • the bug does not occur when updating a primitive.

Sign in to join this conversation.