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

Doesn't have clean up process for the disposed snackbars #19

Closed
b-maslennikov opened this issue Apr 19, 2021 · 5 comments
Closed

Doesn't have clean up process for the disposed snackbars #19

b-maslennikov opened this issue Apr 19, 2021 · 5 comments

Comments

@b-maslennikov
Copy link
Contributor

Hi
Is there any reason why you keep storing snackbars data (objects, heights, keys, refs) despite they've been disposed already.

Screenshot_1

@Aymkdn
Copy link
Owner

Aymkdn commented Apr 19, 2021

In the next release I'll dispose keys and heights.

Regardings $refs, I don't really understand why it's still there. I can see it's Array[0], so basically the reference exists but points to nothing. Maybe it's something to do with Vue? If you have any idea why, please feel free to share.

@b-maslennikov
Copy link
Contributor Author

I'll play with the code. May be I'll find the reason.

Aymkdn added a commit that referenced this issue Apr 19, 2021
@Aymkdn
Copy link
Owner

Aymkdn commented Apr 19, 2021

I'll play with the code. May be I'll find the reason.

Thanks!

I've just released v3.2.2 for keys and heights.

@b-maslennikov
Copy link
Contributor Author

b-maslennikov commented Apr 19, 2021

From the official docs https://v3.vuejs.org/guide/migration/array-refs.html:

In Vue 2, using the ref attribute inside v-for will populate the corresponding $refs property with an array of refs. This behavior becomes ambiguous and inefficient when there are nested v-fors present.

So it creates an array for each v-snackbar
After snackbar removing this array stays empty
So it makes sense to use static ref for all snackbars
:ref="'v-snackbars-'+identifier"
and use idx to get $el
this.$refs['v-snackbars-'+this.identifier][idx].$el

Could you please test this?
PR #20

...or remove refs at all

@Aymkdn
Copy link
Owner

Aymkdn commented Apr 20, 2021

It looks good! Thanks for your help :-)

@Aymkdn Aymkdn closed this as completed Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants