euvl / vue-js-modal

Easy to use, highly customizable Vue.js modal library.
http://vue-js-modal.yev.io
MIT License
4.35k stars 592 forks source link

Clunky behaviour on reloading pages with SSR nuxt #809

Open sinkaroid opened 1 year ago

sinkaroid commented 1 year ago

Dev mode:

Working as intended

Prod mode:

After closing with button, I want to reload pages, the things is <modal> value (raw html) still appear on the pages even it's not clicked/emitted, weird

Version:

vue-js-modal@2.0.1

Example & screenshots:

No, i just have no idea why the <modal> value is pre-appear when reloading pages otherwise working as expected

benjamin-richardson-circular commented 1 year ago

It may depend where you are setting up the value that will trigger the modal. In prod mode, the data on the server is shared across requests. If you are setting something to true on your first load, then doing a refresh where it should not be true....unless you specifically set this to false then Nuxt may still have the value from the previous invocation.

You should test this out by logging the values that trigger the modal while running a prod build version of Nuxt locally using the build and start commands.

I find this happens when something was not originally intended for Nuxt and gets ported over.