Skip to content

Seeking advice for Pagination + liveQuery / reactive #1554

Answered by dfahlander
dellagustin asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry for missing this out and thanks for the reminder!

To only observe any changes to a certain table, the not-yet-documented event storagemutated can be observed as such:

// Subscribe globally:
Dexie.on.storagemutated.subscribe(onStorageMutated);
// Unsubscribe globally:
Dexie.on.storagemutated.unsubscribe(onStorageMutated);

function onStorageMutated(parts) {
  if (Object.keys(parts).some(part => part === 'all' || part.startsWith(`idb://${dbName}/${tableName}/`))) {
    console.log(`Something changed in database ${dbName}, table ${tableName}`);
  }
}

However, an infinite scroller can also be achieved using liveQuery(). Don't know which framework you are using, but I could examplify it …

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dellagustin
Comment options

Answer selected by dellagustin
Comment options

You must be logged in to vote
1 reply
@dellagustin
Comment options

Comment options

You must be logged in to vote
1 reply
@dellagustin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants