Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

thepanda's avatar

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.

0 likes
8 replies
swez_k's avatar

try something like this:

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's avatar

@JussiMannisto I think Laravel reverb automatically comes with pusher-js setup to handle the frontend connection

JussiMannisto's avatar

@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.

1 like
swez_k's avatar

@JussiMannisto I understand, I got confused between pusher and pusher-js. thanks for the clarification.

thepanda's avatar

@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.

1 like

Please or to participate in this conversation.