Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useLiveQuery will not detect database deletions using the truncate optimization #396

Open
DevinFrenze opened this issue Oct 2, 2024 · 0 comments

Comments

@DevinFrenze
Copy link

In the documentation for useLiveQuery for expo-sqlite it may be helpful to include a reference to these two cases in which the update hook will not invoked, which means that change listeners will not be notified of changes.

  1. "the update hook is not invoked when conflicting rows are deleted because of an ON CONFLICT REPLACE clause"
  2. "Nor is the update hook invoked when rows are deleted using the truncate optimization"

Both above quotes are taken from the sqlite update_hook documentation.

The truncate optimization can be avoided by adding .returning() or .where() to the drizzle orm delete statement.

I was trying to figure out why my query results were not changing even when I deleted entire tables from my database, and the truncate optimization was the reason. I'm suggesting that this be included in your documentation because I think it might save other developers debugging time.

If you like this idea, I am happy to draft a PR which adds documentation of this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant