Skip to content

NotificationProvider is mounted on every page and cannot be reached #412

Description

@zachyo

Files: frontend/app/providers/NotificationProvider.tsx (158 lines); frontend/app/layout.tsx line 54; frontend/app/providers/ToastProvider.tsx (242 lines)

Issue: The app ships two parallel notification systems and uses one.

NotificationProvider is mounted third from the top of the provider tree in layout.tsx:54, so its code is in the initial bundle for every route. Nothing consumes it: grep -rn "useNotification\|addNotification\|notify(" app components lib hooks excluding the provider and its own test returns nothing. Its only other reference is app/providers/__tests__/NotificationProvider.test.tsx, which tests an API no caller uses — so the test passes forever and protects nothing.

ToastProvider is the real one, used in 13 files including the new useAdminAction hook, ClaimVesting, PublicTokenPage, all four forms and lib/soroban.ts.

The cost is not just the dead bytes. A contributor adding a notification has two plausible providers to choose from, one of which is wired into nothing, and the passing test suggests it is supported. Open issue #95 (Discord and Telegram webhook alerts) is the kind of work that would land on the wrong one.

Fix: Decide which survives. ToastProvider has the callers, so the cheap path is deleting NotificationProvider, its test and its layout.tsx mount. If NotificationProvider's richer model (persistence, a notification centre) is actually wanted for #95, then migrate the 13 ToastProvider call sites onto it and delete ToastProvider instead — but do one or the other in a single PR rather than leaving both.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions