Skip to content

[Alpha] svelte-query v5 doesn't accept derived stores for options #5668

@skokenes

Description

@skokenes

Describe the bug

In the documentation for svelte-query v5, it is suggested that you can provide stores for queryOptions in order to make reactive queries: https://tanstack.com/query/v5/docs/svelte/reactivity

This works great with writable stores, as seen in this simple example: https://svelte.dev/repl/7d299dce4d9a4b6ba590d6707f383d62?version=4.0.2

However, it does not work with a derived store, as seen in this example:
https://svelte.dev/repl/ee90c13684af4672a19661e9e9021da3?version=4.0.2

The derived store options appear to be completely ignored; no fetching happens.

Your minimal, reproducible example

https://svelte.dev/repl/ee90c13684af4672a19661e9e9021da3?version=4.0.2

Steps to reproduce

Try changing the input box to a different number. Observe that the query never fetches. Also observe in the console that the updated options store value is produced as expected.

Expected behavior

A user should be able to provide a derived store as query options and it should work the same as if a writable store is provided: the query should react to the latest value of the store for its options.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

OSX Chrome

Tanstack Query adapter

svelte-query

TanStack Query version

v5.0.0-alpha.7

TypeScript version

No response

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