Reuse queryOptions, with signal based parameters
TLDR; when i change the $filterName, it does not update the query, when i use queryOptions.
I have a query, that takes 3 arguments as its queryKey: name,pageIndex,pageSize.
As per the docs, i created a function inside a service, that returns a queryOptions function. I think however, the issue here is that the keys initial values are comming from the signal. But further value changes are not propegated to the key, making it so, they queryKey never changes (and no refetching happens)
Im almost certain that i have overseen some utility or method to make this work, as i intended - or maybe theres a better and more elegant solution?
customer.service.ts
customer-page.component.ts
1 Reply
fascinating-indigo•16mo ago
Diagnosing from far away because I don't have a coding environment right now:
Your queryFn does not invoke any signals, so it's not recomputing anything.
One solution might be to have your
listCustomersOptions
take a signal of options, instead of just an object of options, e.g.:
In Component: