Reactive Query Key Change Detection ?
See original GitHub issueHi,
I’m probably missing a detail but I can’t use the reactivity of Svelte for queryKey provided to useQuery().
Here is a very basic example of a search box that is not working :
<script>
import { useQuery } from "@sveltestack/svelte-query";
import debounce from "debounce";
let search = "";
function getTest({ queryKey }) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(`Response for queryKey ${JSON.stringify(queryKey)}`);
}, 500);
});
}
const query = useQuery(["test", search], getTest);
const handleSearch = debounce(event => {
search = event.target.value;
}, 200);
</script>
<input type="search" placeholder="Search" on:input={handleSearch}>
NOTE: the same logic work perfectly with react-query
Thank for this awesome framwork 💚 …and sorry for my english (Google trad)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
Change Detection in Angular: Everything You Need to Know
Maximus Koretskyi introduces change detection in Angular, explaining why use cases with immutables work and how change detection strategy ...
Read more >Effective React Query Keys | TkDodo's blog
The most important part is that keys need to be unique for your queries. If React Query finds an entry for a key...
Read more >Configuring the Apollo Client cache - Apollo GraphQL Docs
This helps you detect changes to a query's result. ... Each key in the object is the __typename of an interface or union,...
Read more >Angular reactive forms key changes detection - Stack Overflow
Compare to check form's valuechanges, you can just watch the form's control value's changes by this.companyForm.controls.xxx.valueChanges.
Read more >Change Detection in Power BI TAIK18 (20-5) Power BI
powerbi #taik18 #changedetectionChange detection is smart way to avoid refresh of all visual in our set scheduled time, it will refresh only ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello, you need to update the query options every time the search text is updated.
Another issue is if you try to use:
the query starts two times. It’s a mess!