fix TypeScript types for AutoDismissFlash hook

This commit is contained in:
Graham McIntire 2026-01-18 10:51:42 -06:00
parent 1b4b7f1773
commit b0d1c8d9b1
No known key found for this signature in database

View file

@ -371,15 +371,17 @@ const ScrollToTop = {
// LiveView hook for auto-dismissing flash messages
const AutoDismissFlash = {
mounted() {
timeout: null as ReturnType<typeof setTimeout> | null,
mounted(this: any) {
const dismissAfter = parseInt(this.el.dataset.dismissAfter || "30000", 10)
this.timeout = setTimeout(() => {
this.el.click()
}, dismissAfter)
},
destroyed() {
destroyed(this: any) {
if (this.timeout) {
clearTimeout(this.timeout)
this.timeout = null
}
}
}