Remote Functions: query().loading is not updating or is not reactive.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
This should reactively flip from true to false but does not.
// Stays true
const isALoading = $derived(queryA().loading);
Doing this instead works as expected:
// Flips from true -> false
const a = queryA();
const isALoading = $derived(a.loading);
Reproduction
Logs
Console logs:
+page.svelte:8 true 'A loading'
+page.svelte:9 true 'B loading'
+page.svelte:9 false 'B loading'
chunk-DHS26EHK.js?v=264bc703:413 stack trace
chunk-DHS26EHK.js?v=264bc703:414 $inspect(...)
at query.svelte.js?v=264bc703:241:6
Severity
serious, but I can work around it
Additional Information
Thanks for building!
Also, is it best practice to set the remote functions to a const const remote = myQuery(); remote.set(...) or use it directly from import: myQuery().set(..)?
I prefer the latter (direct use) because it makes searching for uses of a remote function easier across a code base.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproduction at src/routes/+page.svelte and reproduce the differing behavior between $derived(queryA().loading) and the stored query result. Trace the reported stack through query.svelte.js, then verify that loading changes from true to false reactively for direct calls while the working stored form remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100