How to refresh shared Inertia props with partial reload?
Hello everyone, I'm trying to figure out a way to refresh a specific shared Inertia prop using the partial reload feature. I'm sending a list of recent notification as shared prop (named as notifications using the Inertia middleware but couldn't find a way to only partial reload that specific prop without refreshing the entire page. Is there any way I can achieve this without using APIs? I'm using it with React.
router.reload({
only: ['notifications'], // or whatever you are trying to get.
})
But note that you can't get the latest notifications in real time. you have to reload it manually (like running the function every 5 minutes). if you want to get the notifications in real time you will have to use reverb and pusher or a websocket server
@swez_k Pusher-js is a front-end client for websocket connections. You still need an actual websocket server to connect to. That can be Pusher, Reverb, or something else.
@swez_k Yeah, I will be using polling to refresh the props every 10 seconds. I currently don't have the infrastructure to run and scale a WebSocket server.