lepikhinb / momentum-modal

MIT License
442 stars 26 forks source link

Feature request: remove modal from browsing history on closing #28

Closed jeffreyvanhees closed 1 year ago

jeffreyvanhees commented 1 year ago

Hi!

My use case: I use this modal feature to view a dish on a menu in order to select associated toppings. The problem is that when somebody has viewed 10 dishes sequentially and goes back with the back button, all the modals reappear in the same order from history.

Seems logical considering how InertiaJS is put together, but perhaps it would be a nice addition to provide the ability to disable this behaviour for modals if desired.

iamniels commented 1 year ago

This is a necessity in my opinion. Modals should not appear in the browser history at all. Would this be possible by using the replace option in redirect?

jeffreyvanhees commented 1 year ago

I just saw that a PR has been submitted at Inertia itself that has a preserveUrl-property. Maybe this is also a solution for this case?

See https://github.com/inertiajs/inertia/pull/1259

secondmanveran commented 1 year ago

Has this been implemented already? My modal is not stored in history at all.

lepikhinb commented 1 year ago

@jeffreyvanhees, that's how the package and Inertia.js work since we treat modals as pages. But I'll take that into account

jeffreyvanhees commented 1 year ago

@lepikhinb, @iamniels I've submitted a PR that allows changing the options for Inertia's visit() function called by the redirect() function to enable this. See https://github.com/lepikhinb/momentum-modal-plugin/pull/11