Using usePreloadedQuery with nextjs 14 searchParams
Im having some trouble wrapping my head around the usePreloadQuery and search params. Say I want to have a filter that stores the state in the url, sadly nextjs14 seems to force you into using the client side route cache and toggling between the filters will see some data flicker (the route cache has old data).
Should all of these actually be placed in layouts to avoid the cache when query params change?
1 Reply
edit:
Putting in a layout doesn't work as it breaks the reactivity to the searchparams, I guess i would want to pass these params down to the usePreloadedQuery(preloadedData,{}) as args?
I guess I should go into more detail on my ideal usecase:
page loads with streamed in data taken from the url params, highly performant! Page is then fully reactive and also supports filtering, sorting, etc which all will need to requery the data