Help with "nuqs" aka "next-userquerystate" library - how to refresh data after the state change
Unanswered
Bonga shad posted this in #help-forum
Bonga shadOP
First of all is this library an offical lib? I am truing to refresh my server component that has nested client component that uses nuqs to manage state via query params. On e.g. page change I want to refresh the parent server component. Normally I would call router.refresh() but this does not do anything. I am using next js 14
9 Replies
small thing - "nuqs" stands for "next-usequerystate"
and yeah, that library is highly recommended I think.
and yeah, that library is highly recommended I think.
not sure what you meant by "official lib" but it's good enough 🙂
Its not "official library" per se.
I dont exactly get the issue you are facing. What is being used where and what are you actual trying to achieve.
I dont exactly get the issue you are facing. What is being used where and what are you actual trying to achieve.
Oh btw what next what are you using?
Bonga shadOP
lets say I keep page and size in useQueryState, on change of either size or page I want to rerender the table & refetch the data. I fetch data in server page component (I get searchParams) form props and make the api call server side. My data table is a client compoent that controls the page and size via pagination and select. I just want to refetch the data on page or size change. Or am I doing it wrong ? I bascially want to avoid client side querys with react query etc
@Clown Oh btw what next what are you using?
Bonga shadOP
next.js 14
Ive got it, I had to set shallow: false -> const [size, setSize] = useQueryState("size", {
shallow: false,
});
shallow: false,
});
Asian black bear
To ensure you get the best possible assistance, could you please change your thread title to be more descriptive? Specific titles attract the attention of users who can help and make it easier for others to find similar solutions in the future.
Bonga shadOP
sure, I have now updated the title