Skip to content

[svelte-query] createQueries becomes permanently inactive when initialized with an empty queries array #10681

Description

@NEKOYASAN

Describe the bug

When createQueries is called with an accessor whose queries array is empty at first render, the resulting query slots stay pending / data: undefined forever — even after the input array is later updated to a non-empty value. Subsequent reference updates do not revive any slot.

The same component works correctly if the initial queries array contains at least one entry.

Your minimal, reproducible example

https://svelte.dev/playground/15fedd431f424b7f9d1aac624ac8426a?version=5.55.5

Steps to reproduce

  1. Open the playground.
  2. Section (1) starts with [0] and resolves to success after ~300ms.
  3. Section (2) starts with [] and switches to [0] inside onMount. It stays pending indefinitely.
  4. Click Add page under section (2). Nothing changes — the instance is permanently inactive. (In Section (1), the same operation results in a normal change.)

Expected behavior

Section (2) should behave like section (1) once the queries array has at least one entry.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: MacOS
  • Browser: anything
  • Svelte: 5.55.4

Tanstack Query adapter

svelte-query

TanStack Query version

v6.1.18

TypeScript version

v6.0.3

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions