UPagination
I've set up a watch when the "page" state changes, which refreshes the data, but it has no effect even though the page state does change, why?
8 Replies
Help pls
I've also tried an @click on UPagination but to no avail, it doesn't fit in the function.
Hey, @Furnaxe, sorry I don't have much time to help. Let me just ask a clarifying question, and then if someone else wants to pick up and answer in my place that'll be great: Why do you want to watch the page? I think you should add the page to your useFetch URL directly if I'm correct, because that way, it would be cached appropriately…
Basically watch isn't there but when I use UPagination and try to change page, the refresh doesn't happen even though my page variable changes. I was looking for a way to trigger the refresh either by a watch or an @click as nothing is happening at the moment. Thanks for your time !
Did you try this ?
I think useFetch is waiting for the reactive part of your variable
page
You don't need to use watch()
when you're using useFetch
because it's already looking for changes in his options (included params)
If you want to continue with a watch
solution, ensure the watch is triggered by logging something (and be sure that there's no warn/error logs)I concur with @Kuroro that you should try to pass
page
directly, instead of page.value
because the documentation states:
All fetch options can be given a computed or ref value. These will be watched and new requests made automatically with any new values if they are updated.cf. https://nuxt.com/docs/api/composables/use-fetch#params Let us know if that worked out or not @Furnaxe.
Thanks to all ❤️ It works
@Jeffrey GONZALES @Kuroro
Nice 👍🏻
👍🏻