-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Support for history stack entry replace #6283
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
Comments
I'm all for this feature. Just to add that currently, there are two alternative ways to do this:
Both have the added benefit of not recreating the details page. This can be very important if you have some heavy UI there. |
Yes, I'm aware of both possibilities, but each is a bit different.
If we can pass transition with goBack() - that will be a good workaround that won't re-create the View. |
This would be amazing also for fixing HMR issues with Vue. Right now there is a weird navigation issue nativescript-vue/nativescript-vue#388 caused because when the current page code is changed, there is a navigation action triggered to the same page. In order to fix it, I did a dirty hack for replacing the latest entry in the navigation stack https://github.com/nativescript-vue/nativescript-vue/pull/444/files#diff-c7066f3e92bcad6c8156ffe597acaa48R117 If there was some way to replace the last entry in the navigation stack in the NS API, the developer experience using HMR would be a lot better and my fix would look nicer :) |
If it would help HMR on Vue, it would be a big plus, and wonder if it would help on our Vue-Router issue? |
@jlooper it probably would help on that too. |
Yeah, I logged it around that time. |
The problem with implementing this as a public API lies with transitions. We should be able to not simply replace a navigation entry in the history stack, but also replace a transition on the previous entry, so that when you go back, the transition is fluid. This would require lots of testing against lots of scenarios (we also added nesting navigations recently). As far as our research showed a while back, the native frameworks don't support "replace" out of the box. |
@MartoYankov I guess you already read it, but if not, please read my comment here: nativescript-vue/nativescript-vue#388 (comment) |
Uh oh!
There was an error while loading. Please reload this page.
Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?
Yes
Tell us about the problem
While developing an app, I noticed that {N} doesn't support history replacement as the one the History API has in Web. backstackVisible: false comes close, but has one subtle difference, which I will describe now:
If we use backstackVisible: false, the edit page doesn't enter the stack and goBack() navigates properly on canceling Edit page. However, if we want to navigate to the Details page on Done (to indicate with forward transition, that the changes were stored), the new Details Page is not replacing the old one, and using goBack() in it will navigate it to its previous stack copy - from itself to itself.
In the Web History API, replace is effectively replacing the page in the stack, so going back will just navigate to the previous one in the stack - the correct one.
Using clearHistory in this case is not okay, as we have previous pages in the stack, which we will lose.
Which platform(s) does your issue occur on?
iOS/Android/Both
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: