Skip to content

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

@MerlinB

Description

@MerlinB
  • 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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions