AlexxNB / tinro

Highly declarative, tiny, dependency free router for Svelte's web applications.
MIT License
669 stars 30 forks source link

Make history state oush/replace configureable #91

Open micschwarz opened 2 years ago

micschwarz commented 2 years ago

Currently when changing a parameter, the histoy in the browser is changed (here). It would be nice to make this behavior configurable, so that paramter changes can be pushed into the history instead.

AlexxNB commented 2 years ago

Hello, it is undocumented feature, but router's method go may get second bool parameter - when it is true - history's state will be raplced or pushed otherwise.

router.go('/foo/bar',true); // History will be replaced
router.go('/foo/bar'); // History will be added

I will document this and add attribute for links to control this behaviour.

micschwarz commented 2 years ago

I know, that you can do this for paths, but I think this should be available for parameters as well: router.location.query.set('name', 'alex', true) (Push into the history, instead of replacing the current value)