some pages caching until full reload
Unanswered
Elite posted this in #help-forum
EliteOP
so i have a table and some items that users can add to their list. so on the
problem is the
confused as to why this is happening.
/explore page you add things to your list. and you go to /my-list to view your list (added items)|problem is the
/my-list doesnt update until i do a full page reload (CTRL + R). ive set my links in the navbar to prefetch={false} and i did export const dynamic = "force-dynamic"; at the top of the page.tsxconfused as to why this is happening.
26 Replies
not sure if you're facing the same challenge as I was @Elite , but have you tried using Templates?
https://nextjs-forum.com/post/1255626619247136919
https://nextjs-forum.com/post/1255626619247136919
still have to reload the page completely for it to update
EliteOP
any other ideas @decorum ?
Palomino
Think so, you are using a proper state management solution that allows state to be shared across different pages. Common solutions include using React Context, Redux, or even Zustand. This way, when you add an item on the /explore page, the state will be updated globally, and the /my-list page will react to those changes.
@Palomino Think so, you are using a proper state management solution that allows state to be shared across different pages. Common solutions include using React Context, Redux, or even Zustand. This way, when you add an item on the /explore page, the state will be updated globally, and the /my-list page will react to those changes.
EliteOP
well it adds it to a db. and
/my-list calls itits using drizzle and gets the fetched data passed as props to the child client table component
Palomino
At first, You have to ensure that the data fetching on the /my-list page happens on the client side to allow dynamic updates without a page reload.
And then confirm of use a state management solution (like React's Context API or a global state library like Redux) to manage the state of the user's list across different components.
Palomino
In the server-side, For a more real-time update approach, consider using WebSockets or Server-Sent Events (SSE) to push updates from the server to the client whenever the list changes.
EliteOP
lol
same thing though
im literally pulling from db on page load
so
should i check if the drizzle query is cached
EliteOP
never mind got it working
i made all the fetch data functions server actions and it works now
I'm curious if a
It genuinely sounds like you're doing exactly what Lee Rob does in his Server Actions tutorial video --> https://youtu.be/dDpZfOQBMaU?si=YOnqecXTOsIcfWqd
revalidatePath('/my-list') as part of a server action when you add things on '/explore' would have helped, too. It genuinely sounds like you're doing exactly what Lee Rob does in his Server Actions tutorial video --> https://youtu.be/dDpZfOQBMaU?si=YOnqecXTOsIcfWqd
Not that using Actions to fetch data is bad or anything, but it can lead to unexpected behavior as well (at least it did for my team)
EliteOP
hmm alr ty