Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the prompt dialog button #528

Open
NiallJoeMaher opened this issue Oct 13, 2023 · 11 comments
Open

Fix the prompt dialog button #528

NiallJoeMaher opened this issue Oct 13, 2023 · 11 comments

Comments

@NiallJoeMaher
Copy link
Contributor

Context

We have a component used in to catch unsaved changes on an article so a user doesn't accidentally navigate away.

It is commented out at the moment because since Next.js version 13 (and the app router) it no longer behaves as expected.

Expected Behavior

Fix the PromptService component (components/PromptService/PromptService.tsx) so that it works in the new app router.
When it is complete we should be able to add them back into the editor so the user is warned if they are about to navigate away.

Current Behavior

It's totally broken. 🙃

@Joseph2001-braganza
Copy link

I can work on this issue.

@Joseph2001-braganza
Copy link

I suppose It should throw a prompt message when the user tries to navigate to another link, while writing a post ?

@NiallJoeMaher
Copy link
Contributor Author

NiallJoeMaher commented Oct 14, 2023

Yes it's working on the production site at the moment in case you want to see it.

This is when you are logged in and try to create an article (https://www.codu.co/create)

There is autosave functionality, but if the user is about to navigate away they see the modal in the screenshot.

Screenshot 2023-10-14 at 07 33 32

@Joseph2001-braganza
Copy link

Joseph2001-braganza commented Oct 14, 2023

Yes I checked it.It works only once when I try to navigate back.Shouldn't it work every time when some one is navigating to different routes or once should work ? I will try to fix this issue.
In Production there is no theme like dark and light theme.Since in the dev when I try to change the theme to light the text in the post is also black, it camouflages with the background color.
Screenshot 2023-10-14 at 12 13 53 PM

@NiallJoeMaher
Copy link
Contributor Author

Thanks for that! I've been opening issues for fixing this stuff so I'll add it to the pile of issues to pick up.

And since the change to the /app router we now use the next package called "next/navigation" which doesn't have the same hooks as before (and that's what caused it to break).

@NiallJoeMaher
Copy link
Contributor Author

@Joseph2001-braganza let me know if you are tackling this or if I should release it. 🦾 Thanks!

@Joseph2001-braganza
Copy link

I was looking out for some potential solutions for this but couldn't find one.I guess due to the new version the Next Js team is developing it and still under development as per the github issue thread of Next Js.

@NiallJoeMaher
Copy link
Contributor Author

Dang! This newest version of next has thrown some issues... 😢

@seog-jun
Copy link
Contributor

seog-jun commented Dec 1, 2023

@NiallJoeMaher Can I have a look? I'm not sure there's a workaround for it

@NiallJoeMaher
Copy link
Contributor Author

All yours @seog-jun! I have no idea yet.

@seog-jun
Copy link
Contributor

seog-jun commented Dec 4, 2023

@NiallJoeMaher Huh.. there's no simple workaround here.. even version 14 doesn't come with router.events

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants