-
-
Notifications
You must be signed in to change notification settings - Fork 906
Open
Labels
bugThings that aren't working right in the library.Things that aren't working right in the library.
Description
Describe the bug
When using countdown
and duration
attributes on an SlAlert
, the component doesn't wait for countdownElement
to be defined (i.e doesn't wait for first update/render), before attempting to use it. I'm not experienced with web components or shoelace, but I think this is a bug. If it's user error, feel free to close. Thanks
I believe it could be fixed like this in alert.component.ts
, I can open a PR if this seems correct:
@watch('duration')
async handleDurationChange() {
+ await this.updateComplete;
this.restartAutoHide();
}
Alternatively, it may make more sense to put this await
in handleDurationChange
.
To Reproduce
Steps to reproduce the behavior:
- Use the codepen below
- Click show alert
- Open web console to see the stack trace. Note codepen console may not show it.
handleCountdownChange https://cdn.jsdelivr.net/npm/@shoelace-style/[email protected]/cdn/chunks/chunk.BSPH4GYQ.js:105
restartAutoHide https://cdn.jsdelivr.net/npm/@shoelace-style/[email protected]/cdn/chunks/chunk.BSPH4GYQ.js:73
handleDurationChange https://cdn.jsdelivr.net/npm/@shoelace-style/[email protected]/cdn/chunks/chunk.BSPH4GYQ.js:138
update https://cdn.jsdelivr.net/npm/@shoelace-style/[email protected]/cdn/chunks/chunk.JMZM2TDT.js:21
update https://cdn.jsdelivr.net/npm/@shoelace-style/[email protected]/cdn/chunks/chunk.JMZM2TDT.js:14
performUpdate https://cdn.jsdelivr.net/npm/@shoelace-style/[email protected]/cdn/chunks/chunk.OOP2EFQH.js:520
scheduleUpdate https://cdn.jsdelivr.net/npm/@shoelace-style/[email protected]/cdn/chunks/chunk.OOP2EFQH.js:501
_$ET https://cdn.jsdelivr.net/npm/@shoelace-style/[email protected]/cdn/chunks/chunk.OOP2EFQH.js:497
Demo
https://codepen.io/cam194871/pen/emNJyGb
Screenshots
N/A
Browser / OS
- OS: Fedora Linux 42
- Browser: Firefox
- Browser version: 138.0.4
Additional information
N/A
Metadata
Metadata
Assignees
Labels
bugThings that aren't working right in the library.Things that aren't working right in the library.