Fix visible toast messages flickering when one disappears #4749
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix visible toast messages flickering when one disappears
Pull Request Type
Description
As we were previously using the array index for the
:key
in the toast'sv-for
, it meant than when a toast disappears, all of the toasts would get re-rendered by Vue, as the items would be at different indexes, causing the CSS animations to trigger again which results in the flickering effect.This pull request assigns each toast a unique ID, which means that when the toasts array changes, the keys don't change, so Vue knows it only needs to update the toasts that are being added or removed.
Screenshots
Testing
Click the
Set Current Instance as Default
andClear Default Instance
buttons in the general settings section to create a bunch of toasts. Watch the toasts as some of them start disappearing, after this pull request they should no longer flicker.Desktop