How to show a warning when user attempts to navigate with unsaved changes in app router?
Unanswered
Arboreal ant posted this in #help-forum
Arboreal antOP
Hey all,
I'm trying to figure out how to add some sort of "you have unsaved changes" warnings to some client components. I've been googling around and there are options for the pages router as you could easily tap into Router.events. I've been trying a few things but haven't managed to get it working with the app router in next v14.1
Has anyone managed to implement this feature yet? Can you share any tips please? Ideally I'd like to make some sort of hook where I can pass in 'hasUnsavedChanges: boolean'.
I'm trying to figure out how to add some sort of "you have unsaved changes" warnings to some client components. I've been googling around and there are options for the pages router as you could easily tap into Router.events. I've been trying a few things but haven't managed to get it working with the app router in next v14.1
Has anyone managed to implement this feature yet? Can you share any tips please? Ideally I'd like to make some sort of hook where I can pass in 'hasUnsavedChanges: boolean'.
2 Replies
Arboreal antOP
Bump
Arboreal antOP
Is this even possible with nextjs? Seems like an oversight if it isn't.