feat(queries): add setEnabled function to queries and infinite queries#33
Conversation
|
Thanks :) |
|
Hmmm... I'm not sure that all options need this reactivity. Maybe a good way to handle all other cases would be to add a function named eg: function mergeOptions(options: UseQueryOptions<TQueryFnData, TError, TData>): void {
observer.setOptions({ ...observer.options, ...options })
}What do you think? |
|
Yes, cool... it seems ok for me 👍 |
|
Do you have a preference on naming? |
|
maybe updateOptions :) |
|
Hi @amen-souissi, I added the Is there something missing before merging? |
|
I'm so sorry I haven't seen the changes :( ... merged and released 👍 |
|
There is absolutely no problem 😁 ! Thank you for merging and releasing this, I will update my stack. |
|
Can this apply to, useQueries, as well? |
In some situations, we need to enable or disable queries using svelte reactive statements.
We can do this using the
setOptionsmethod but it forces us to pass all options.It could be very useful to have a
setEnabledshortcut function which reuse existing options and only update theenabledoption.It allows this code:
to become
It makes the code more readable and understandable.
Do you agree?