fix(frontend): dedupe identical banners in banner.ts

Multiple independent requests that fail with the same message (e.g.
Activities.tsx's mount effect firing loadFirstPage/listWorkoutKinds/getProfile
separately) each call showError() independently, previously stacking
2-3 textually-identical banners for a single root cause (backend down,
brief network blip). show() now skips adding a banner if one with the
same severity+message is already visible, and skips scheduling a
redundant auto-dismiss timer for it -- the original banner's timer
keeps running untouched.
This commit is contained in:
2026-07-27 10:34:57 +02:00
parent 83a59d0fdd
commit f9b1d454bc

View File

@@ -17,6 +17,11 @@ function notify() {
} }
function show(severity: BannerSeverity, message: string): void { function show(severity: BannerSeverity, message: string): void {
const isDuplicate = banners.some(
(b) => b.severity === severity && b.message === message,
);
if (isDuplicate) return;
const id = nextId++; const id = nextId++;
banners = [{ id, severity, message }, ...banners]; banners = [{ id, severity, message }, ...banners];
notify(); notify();