Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] clean up bootable content on close #6764

Closed
DRoet opened this issue Mar 19, 2019 · 4 comments
Closed

[Feature Request] clean up bootable content on close #6764

DRoet opened this issue Mar 19, 2019 · 4 comments
Assignees
Labels
C: VDialog VDialog C: VMenu VMenu T: enhancement Functionality that enhances existing features
Milestone

Comments

@DRoet
Copy link
Contributor

DRoet commented Mar 19, 2019

Problem to solve

See: #4518, this might make more sense now that lazy is the new default in 2.0.

I know a workaround is to use a v-if on the content, but this can cause issues with transitions

Proposed solution

Make sure content inside a v-dialog etc. rerenders by default, a prop like keep-alive could be introduced to get the current behaviour

@MatthewAry
Copy link
Contributor

MatthewAry commented Jan 30, 2020

All of the applications that I have been building are very data driven and produce A LOT of DOM nodes. One of the ways that I can reduce the DOM node overhead (aside from using a some special observer events to deterministically unload nodes) is to put UI into dialog boxes. In order to keep my UI lean on DOM Node usage, I need to be able to clean up the contents of a dialog after it closes. This feature can be very valuable to keep the browser performant. Also:

Use case for this feature
A dialog is used to add users to the recipients of an email. When users are selected and added to the recipient list, the users that have already been added should not show up when the dialog box is opened again.

The dialog contents gets the user list data upon creation. We could perform a getUsers request to the server after we click the apply button but that could amount to unnecessary requests to the server. Instead the preferred solution is to get a new list of users every time the dialog is opened. The easiest way to do this is to destroy component being rendered in the dialog box after the dialog is closed and create the dialog contents fresh every time its opened. This ensures that the data stays fresh.

@MatthewAry
Copy link
Contributor

MatthewAry commented Mar 10, 2020

Currently for almost every single dialog I have to have two state variables. One to track if the dialog is visible showDialog, and the other to render the dialog's contents renderDialog. I have a watcher on the showDialog variable which will set the renderDialog variable to true whenever showDialog is true. When showDialog changes to false, then I set renderDialog to false after a 300ms delay.

I end up doing this almost every single time. It's getting very tedious.

@MatthewAry
Copy link
Contributor

Would like to see this added to V3

@marcnewton
Copy link

I too have found over 90% of my usage case of dialog I need it to destroy inner content.

Made my own dialog in Vue 3 that does this without ruining the close animation, so easy to achieve vs Vue 2.
Vuetify 3 will benefit greatly, looking forward to V3 and I hope my projects put me in a position to sponsor Vuetify.

@KaelWD KaelWD changed the title [Feature Request] make bootable rerender by default [Feature Request] clean up bootable content on close Feb 26, 2021
@KaelWD KaelWD added T: enhancement Functionality that enhances existing features and removed T: feature A new feature labels Feb 26, 2021
@KaelWD KaelWD assigned KaelWD and unassigned DRoet and johnleider Feb 26, 2021
@KaelWD KaelWD added the C: VMenu VMenu label Feb 26, 2021
@KaelWD KaelWD modified the milestones: v3.0.0, v2.5.0 Mar 3, 2021
@johnleider johnleider modified the milestones: v2.5.0, v3.0.0 Mar 24, 2021
KaelWD added a commit that referenced this issue May 5, 2021
KaelWD added a commit that referenced this issue May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VDialog VDialog C: VMenu VMenu T: enhancement Functionality that enhances existing features
Projects
No open projects
Development

No branches or pull requests

6 participants