slovnicki / beamer

A routing package built on top of Router and Navigator's pages API, supporting arbitrary nested navigation, guards and more.
MIT License
591 stars 129 forks source link

Expose `tryPopping` for history control in BeamLocation #588

Open Bungeefan opened 1 year ago

Bungeefan commented 1 year ago

Is your feature request related to a problem? Please describe.

We are trying to exactly match the history the user entered when using our app, even duplicates entries in the same location. Currently, the logic for removing duplicate entries in the location history (not the beamingHistory) prevents us from fulfilling this.

Example:

In the browser, it works exactly like this, as the browser history is not affected by the Beamer clear logic. Browser pushes B again when the user presses the back button.

Describe the solution you'd like

Being able to control BeamLocation.addToHistory(tryPopping) either globally or when using beamXXX, or both. Similar to BeamerDelegate.removeDuplicateHistory, just for the particular location history.

Describe alternatives you've considered

Clearing the first entry of A manually, this stops the Beamer from clearing the whole history in this location, but this is then inconsistent with the behavior of the back button in the web.

Additional notes

"Bug/Behavior" that is currently blocking this feature: #589