Skip to content

Fix notification read state persistence across tabs - #921

Merged
greatest0fallt1me merged 2 commits into
Predictify-org:mainfrom
belloaliyu11:fix-902-notification-read-state-tabs
Aug 29, 2026
Merged

greatest0fallt1me merged 2 commits into
Predictify-org:mainfrom
belloaliyu11:fix-902-notification-read-state-tabs

Conversation

@belloaliyu11

Copy link
Copy Markdown
Contributor

Overview

  • Persist notification read state without allowing stale tabs to mark already-read notifications unread again.
  • Merge stored read flags during hydration, local writes, setNotifications, and cross-tab storage events.
  • Keep malformed or unavailable localStorage handling defensive and preserve timestamp revival for persisted notifications.

Related Issue
Closes #902

Changes

  • Added monotonic read-state merging for persisted notification data.
  • Added one global storage listener guarded against duplicate registration.
  • Added focused Zustand store tests for persistence, malformed storage, retries/failures, stale writes, and cross-tab updates.

Verification Results

  • PASS: corepack.cmd pnpm test -- app/state/__tests__/notifications.test.ts --runInBand
  • PASS: corepack.cmd pnpm lint (existing warning in app/layout.tsx: @next/next/no-page-custom-font)
  • PASS: git diff --check (only Git CRLF warning in working copy)
  • FAIL: corepack.cmd pnpm type-check --pretty false due unrelated existing/sparse-checkout errors in app/layout.tsx, app/not-found.tsx, and app/state/walletPrefs.ts
  • NOT RUN: prettier check because prettier is not installed in this repo

Acceptance Criteria

Criteria Status Notes
Read state persists safely Met Stored read flags are merged, not blindly replaced.
Cross-tab updates are safe Met Storage events apply read=true only and do not revert local reads.
Malformed/failed storage is defensive Met Invalid JSON and localStorage failures are ignored without breaking UI state.
Tests cover duplicate/boundary/failure behavior Met Focused Jest tests added for idempotency, malformed values, stale writes, and storage failures.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@belloaliyu11 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

@belloaliyu11 is attempting to deploy a commit to the Jagadeesh B's projects Team on Vercel.

A member of the Team first needs to authorize it.

@greatest0fallt1me
greatest0fallt1me merged commit 99a11ee into Predictify-org:main Aug 29, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Quality-2][High] Persist notification read state across tabs safely

2 participants