fix(web): notifications dismiss integrity and feed-consistent badge #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/notifications-integrity"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes two Important findings from the repo-wide review:
Dismiss failures are no longer silent.
dismissAlert/dismissMarketAlertnow throw on!res.ok(matching the rest of client.ts); Clear all usesPromise.allSettledand re-throws so react-query reports failures, whileonSettledinvalidation still reconciles the UI to server truth; mutation errors render in the Notifications card using the same pattern as Trading.Clear-all and the nav badge now agree. Previously Clear all dismissed only the collapsed (latest-per-symbol) feed items, leaving older same-symbol alerts
newon the server, while the badge counted all new signal alerts and ignored market alerts — yielding an empty feed under a stuck badge. Now:POST /api/alerts/dismiss-allandPOST /api/market-alerts/dismiss-all(optional zod-validated{ before }), backed by parameterized Drizzle updates.buildFeed/collapseBySymbolextracted tosrc/lib/notifications.ts; the badge derives from the samebuildFeedover both alert types, so it counts exactly what the feed shows.Note: badge semantics change from raw
ackStatus === "new"count to feed length (collapsed, both kinds) — equivalent in practice since nothing setsacknowledged.New tests: 6 server route tests (bulk dismiss,
beforeboundary, bad body), client tests for throw-on-error and bulk paths, container tests for Clear all via FakeEventSource + fetch stub, badge-consistency test. Full repo 307 tests green; typecheck clean.POST /api/alerts/dismiss-all and /api/market-alerts/dismiss-all with an optional zod-validated { before } body (dismiss everything with ts <= before). Backed by Repositories.dismissAllAlerts/dismissAllMarketAlerts.d1d6ced63ftocd50808d04cd50808d04to512ef3211a