Skip to content

Can you rerender parts of a persistent layout? #349

Discussion options

You must be logged in to vote

Hi,

The Inertia Way™ to do this, is to simply share the list of (unread) notifications on every single request (you can cache them server-side if needed, as to not continuously re-query the database).

Then, as you mark a notification as read (by making an Inertia visit when clicking the 'mark as read' button), the database updates the notification, and the request redirects you back to the page you were already on.

Because the 'source' and 'target' pages are the same / use the same Page Component, Inertia will essentially only update the page's props, which should now be a fresh notification list, without the notification we just marked as read.

Then, through Vue's reactive re-rendering '…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@amiranagram
Comment options

Answer selected by claudiodekker
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #349 on December 19, 2020 17:21.