-
Notifications
You must be signed in to change notification settings - Fork 8.5k
DEV: standardise toasts duration #32741
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
Conversation
Toasts can now have two durations: - `short` -> 3000ms - `long` -> 5000ms Anything else will be converted to 3000ms
get duration() { | ||
let duration = this.args.toast.options.duration; | ||
|
||
if (duration === "long") { | ||
return 5000; | ||
} else { | ||
return 3000; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some plugins use toasts, so maybe we need a backwards compatible code path with a deprecation warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I hesitated, but I think in this case, it's not breaking the application, it's mostly a UX detail. Maybe I could get convinced that 5000 is a better default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know what? OK let's show a deprecation message, I don't really mind and we can just remove it in 6 months.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, maybe if duration is an integer we can show the deprecation warning and allow returning the value for the short term. Probably not a big deal though, I can't imagine there are many cases where anyone wants a toast for more than 3-5 seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I don't have strong preference but can add a deprecation notice or allow for integer values too if you decide.
Toasts can now have two durations:
short
-> 3000mslong
-> 5000msAnything else will be converted to 3000ms