fix(powersync): Don't flush records when diff trigger isn't setup yet when using on-demand mode. - #1585
Conversation
Update main
Update From Upstream
chore: Update from upstream
…t. This fixes a non-critical error that was logged on startup.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR updates on-demand sync cleanup and initialization to skip diff-trigger flushing and disposal when no tracking trigger exists, preventing operations against uninitialized or dropped tracking tables. ChangesDiff trigger initialization safety
Estimated code review effort: 2 (Simple) | ~8 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@samwillis - could you review this one please? |
|
Thanks for this. I pulled it into a stack with #1688 and ran the PowerSync package tests. The initial guard is pointed in the right direction, but Can you clear the tracking state as part of disposal and add a regression test that fails on the old code, including the unload/cleanup path? Once that and CI are green, this should be good to merge. |
…ck-db into fix/no-flush-on-init
Done, thanks for the feedback! |
More templates
@tanstack/angular-db
@tanstack/browser-db-sqlite-persistence
@tanstack/capacitor-db-sqlite-persistence
@tanstack/cloudflare-durable-objects-db-sqlite-persistence
@tanstack/db
@tanstack/db-ivm
@tanstack/db-sqlite-persistence-core
@tanstack/electric-db-collection
@tanstack/electron-db-sqlite-persistence
@tanstack/expo-db-sqlite-persistence
@tanstack/node-db-sqlite-persistence
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/react-native-db-sqlite-persistence
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/tauri-db-sqlite-persistence
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
🎯 Changes
Users reported an error that occurs during startup when using
on-demand:An error has been detected in the sync handler Error: no such table: __XXXX_tracking_6bed0e00. During initialisation we were flushing records before the diff trigger was setup.This change simply skips flushing if the diff trigger hasn't been setup yet.
✅ Checklist
pnpm test.🚀 Release Impact
Summary by CodeRabbit