Skip to content

Multiple autoDismiss are getting set #69

@sun-mota

Description

@sun-mota

clearTimeout before setting a new one to avoid multiple effect

Whenever any attribute is changed, a new timer for autoHide gets set without clearing the previous one.

updated(changedProperties) {
if (changedProperties.has('visible')) {
this.handleSlotContent();
}
if (changedProperties.has('variant')) {
clearTimeout(this.fadeOutTimer);
}
// do not auto dismiss for error toasts or if disableAutoHide is set
if (this.visible && !this.disableAutoHide && this.variant !== 'error') {
this.fadeOutTimer = setTimeout(() => {
this.fadeOutToast();
}, TIME_TIL_FADE_OUT);
}
}

Originally posted by @sun-mota in #67 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions