momentum-modal icon indicating copy to clipboard operation
momentum-modal copied to clipboard

Feature request: remove modal from browsing history on closing

Open jeffreyvanhees opened this issue 2 years ago • 2 comments

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.

jeffreyvanhees avatar Oct 03 '22 11:10 jeffreyvanhees

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?

iamniels avatar Oct 10 '22 18:10 iamniels

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

jeffreyvanhees avatar Oct 21 '22 09:10 jeffreyvanhees

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

secondmanveran avatar Dec 17 '22 16:12 secondmanveran

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

lepikhinb avatar Jan 23 '23 21:01 lepikhinb

@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

jeffreyvanhees avatar Jul 10 '23 11:07 jeffreyvanhees