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

Replace is ignored by beforeRouteEnter #3325

Closed
McPo opened this issue Sep 17, 2020 · 1 comment
Closed

Replace is ignored by beforeRouteEnter #3325

McPo opened this issue Sep 17, 2020 · 1 comment

Comments

@McPo
Copy link

McPo commented Sep 17, 2020

Version

3.4.3

Reproduction link

https://jsfiddle.net/emcpoland/xb4kqLug/58/

Steps to reproduce

  1. Click Items (The latest item id is "fetched from the server" and the user redirected to that items page)

  2. Click delete (A dialog appears)

  3. Click ok (The dialog is "dismissed" and the user is redirected to the next items page. Replace is used so that when the user clicks back, they don't see the dialog again [they would see the deleted item again, but in a real world situation it would say the item has been deleted])

It appears the fact that the navigation was meant to be a "replace" is dropped because of the navigation guard. Either "replace" should naturally be inherited or navigation guards should provide extra context and state that the navigation was meant to be a "replace". For now you can workaround this by passing replace:true in the props but its quite nasty IMO

What is expected?

Pressing back after deleting an item should present with the previous item, not the previous item delete dialog.

What is actually happening?

The delete dialog of the previous item is being shown. This is because despite the dialog using a replace navigation, this isnt carried over into the navigation guard. The guard also lacks context as to whether it should have been a replace or not.

@posva
Copy link
Member

posva commented Sep 17, 2020

Duplicate of #1620

@posva posva marked this as a duplicate of #1620 Sep 17, 2020
@posva posva closed this as completed Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants