Duplicate $alert notifications appear after SSR hydration in Nuxt 3 with @nuxtjs/alert
0 reputation · 31 Aug 2022, 09:18 UTC
Goal
Prevent duplicate alert messages from appearing when the same $alert call is executed both during server‑side rendering and again after client‑side hydration in a Nuxt 3 application using @nuxtjs/alert.
Constraints / Uncertainty
The module does not expose a built‑in option to suppress client‑side re‑emission of server‑rendered alerts, and there is no documented way to attach a unique identifier or deduplication key to alerts. Developers currently rely on manual workarounds such as guarding calls with process.client or using timers, which are undocumented and may introduce race conditions or memory leaks.
Questions
- Is there a supported method to disable the client‑side re‑triggering of alerts that were already shown during SSR?
- Can the alert instance be configured with a deduplication mechanism (e.g., message ID) to avoid duplicate notifications?
- Does Nuxt 3 provide a lifecycle hook or configuration flag that prevents hydration of alert state for server‑rendered messages?