You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* docs(svelte-db): Add documentation for destructuring reactivity issue (#414)
## Summary
This commit addresses issue #414 where users reported that destructuring
the return value from useLiveQuery() breaks reactivity in Svelte 5.
## Root Cause
This is a fundamental limitation of Svelte 5's reactivity system, not a
bug in the library. When objects with getters are destructured, the
destructuring evaluates getters once and captures the values at that
moment, losing the reactive connection.
## Solution
Added comprehensive documentation explaining:
- Why direct destructuring breaks reactivity
- Two correct usage patterns:
1. Use dot notation (recommended): `query.data`, `query.isLoading`
2. Wrap with $derived: `const { data } = $derived(query)`
## Changes
- Updated JSDoc comments in useLiveQuery.svelte.ts with detailed
explanation and examples
- Updated README.md with clear usage guidelines
- Added test case demonstrating the correct $derived pattern
- All 23 existing tests continue to pass
## References
- Issue: #414
- Svelte documentation: sveltejs/svelte#11002
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* chore(svelte-db): Revert README changes to keep it minimal
The README is intentionally kept small, so reverting the detailed
documentation. The comprehensive documentation remains in the JSDoc
comments in useLiveQuery.svelte.ts.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* chore: Remove package-lock.json (project uses pnpm)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>
0 commit comments