Skip to content
Source
Sign inSign up
TanStack/db

svelte-db: flushSync inside effect breaks Svelte 5 async compiler mode #744

ClosedMerlinB(GitHub profile, opens in a new tab) opened this issue 0 comments
  • I've validated the bug against the latest version of DB packages

Describe the bug TanStack Svelte DB is incompatible with Svelte 5's async compiler option due to calling flushSync() inside an effect, which violates its reactivity constraints:

https://github.com/TanStack/db/blob/48b8e8fc08ba8b0589476b5fd294f44b09f8ce8c/packages/svelte-db/src/useLiveQuery.svelte.ts#L357

The bug that this triggers: Uncaught Svelte error: flush_sync_in_effect Cannot use flushSync inside an effect

See https://svelte.dev/e/flush_sync_in_effect

To Reproduce Steps to reproduce the behavior:

  1. Enable async compiler in svelte.config.js
  2. Use useLiveQuery in any component
  3. Navigate to the page → Error occurs during collection initialization

Desktop (please complete the following information):

  • OS: iOS
  • Browser chrome
  1. KyleAMathews closed this

Sign in to join this conversation.