[Feature Request] Add or improve history actions
Thanks for the great lib!
It would be nice to have a shortcut to modify Turbo.navigator.history. I find it an essential action since the Back button is not doing what is expected when the browser history is modified without touching Turbo.navigator.history. As a workaround, the invoke action can be used at the moment.
More on the issue: https://discuss.hotwired.dev/t/back-button-not-working/3012
P.S. I'd really love to help but I'm not very familiar with Typescript yet :/
Thanks for opening this!
I'm happy to take a look on adding such an action!
@marcoroth FYK navigation isn't that simple, unfortunately. See this: https://github.com/hotwired/turbo/issues/792
I was wondering if expanding the push_state action would be worth thinking about:
https://github.com/marcoroth/turbo_power/blob/623a6f5b11608073ac36880bd1f0cc4745a52e56/src/actions/history.ts#L3-L9
Sounds OK if that would let one push state solely on window.history or the Turbo.navigator.history (sometime you want or another)
Yeah, I thought it could be similar to how redirect_to works.
https://github.com/marcoroth/turbo_power/blob/623a6f5b11608073ac36880bd1f0cc4745a52e56/src/actions/browser.ts#L17-L29
By default it uses the one on Turbo, but if you don't want that or if Turbo is not available it falls back to window