QModal is not destroyed on close
I’m developing a Quasar application consisting of an array of QCards with an action button that opens a QModal associated to each one. I’ve noticed that my QModals are only effectively rendered (I mean, added to the DOM) when I invoke their
open()method. However, they are not destroyed (I mean, removed from the DOM) when I invoke their
close()method, but only hidden (with style
display: none). In my application, this behaviour is undesirable, because it can lead to a lot of hidden modals polluting my DOM, and potentially increasing my RAM consumption unnecessarily.
Why this assymmetry? What’s the right way to destroy a QModal on close?
QModals are “reusable”, since they do get added to DOM when first opened, but they are not totally destroyed when closed (because they can be reopened). The DOM elements get removed when navigating away or the component that contains them gets destroyed.
Do you really need a method to get Modals removed from DOM on close?
Maybe I am wrong but my problem might be ‘related’, as I can not determine when the modal elements of my modal are ready (since the modal is already there to be reused):
@MusicForMellons Use V-if to ensure the creation / destruction of the parent element within QModal, so I do and it works great!
@rogeriomq I do know v-if but can’t quite see how it would solve my issue. I need a proper hook for triggering a DOM calculation…, whereas v-if triggers a render for an element.