No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    QModal is not destroyed on close

    Framework
    4
    5
    1913
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      lbssousa last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        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?

        1 Reply Last reply Reply Quote 0
        • M
          MusicForMellons last edited by

          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):
          https://github.com/quasarframework/quasar/issues/986

          R 1 Reply Last reply Reply Quote 0
          • R
            rogeriomq @MusicForMellons last edited by

            @MusicForMellons Use V-if to ensure the creation / destruction of the parent element within QModal, so I do and it works great!

            1 Reply Last reply Reply Quote 0
            • M
              MusicForMellons last edited by

              @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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post