Skip to content

ExpoSQLitePersistence + queryCollectionOptions + offline-transactions - stale items after insert #1618

Description

@tombryden
  • I've validated the bug against the latest version of DB packages

Describe the bug
With persistedCollectionOptions (ExpoSQLitePersistence) + queryCollectionOptions + offline-transactions (although I imagine it probably occurs without offline-transactions given the diagnosis below)

I've done a little bit of debugging and it seems to point to the owners metadata not getting set properly when inserting, so when the query responds on app launch it doesn't clean up the stale data.

To Reproduce
Steps to reproduce the behavior:

  1. Insert item on app (sync occurs via the offlineExecutor mutationFn) - item appears in db + api response
  2. close app
  3. delete the inserted item from the db (no longer appears in list items API response)
  4. open app to list items

Expected behavior
I would expect in step 4, it would realise that the API response doesn't contain the inserted item anymore, and clean up the stale item. Instead, the stale item remains, despite the API response returning [].

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: iPhone 13 Pro
  • OS: iOS 26.5
  • Expo Development Build SDK 56

Additional context
Note there is another bug related to the typing of SQLite.SQLiteDatabase -> ExpoSQLiteDatabaseLike so I initialise like this: const persistence = createExpoSQLitePersistence({ database: database as unknown as ExpoSQLiteDatabaseLike, }); - but this shouldn't cause this issue. There is a PR addressing this here (I haven't tested - but it has been raised): #1560

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions