Closed nullrocket closed 2 years ago
Sorry about all the noise around validate/style. I always forget 160 != 80. I can't deal with short lines. Pre-commit hooks are awesome until you rely on them and they are not there :)
I'll check this out. in the meantime, there needs to be some mention in the docs. can you work on that @nullrocket ?
If I've got routerNeglect
set to true
, which the use of Router.neglect
when calling GoRouter.push
?
It doesn't look like Router.neglect
is needed when using routerNeglect: true
. However, it works nicely on a per navigation event when you're using routerNeglect.false
. I think the story for the docs would be something along the lines of the following:
Sometimes you don't want the browser tracking history when you navigate. In that case, use
Router.neglect
(snippet). And if you'd like the browser to stop tracking history altogether for your app, userouterNeglect: true
(snippet).
Nice!
@csells Ahh, yeah the example should have been using navigator on that button labeled Navigator.push to show how to get the effect outside go_router. Fixed.
I'll work on the docs.
Added routerNeglect option to GoRouter. Added router_neglect.dart example. Updated examples list in docs.
Not sure about how you want to document this, I did create an example for it.
:sparkles: What kind of change does this PR introduce? (Bug fix, feature, docs update...)
Adds optional flag routerNeglect to suppress creation of history entries on the web.
:arrow_heading_down: What is the current behavior?
No way to suppress web history outside of go_router.
:new: What is the new behavior (if this is a feature change)?
Allows globally disabling history creation on the web. Global meaning as long as they are using go_router. Any other navigation methods outside of go_router have to be wrapped by the developer manually.
:boom: Does this PR introduce a breaking change?
No
:bug: Recommendations for testing
All tests pass, and all examples run, I can't work out a way to automatically test that no history entries are created that would be worth automating, looking at the flutter tests for Router.neglect didn't reveal any insight.
:memo: Links to relevant issues/docs
https://github.com/csells/go_router/issues/226
:thinking: Checklist before submitting
master
.