Skip to content

fix(notifications): mark a notification read when its toast is opened - #242

Merged
andrebrait merged 3 commits into
kahme247:mainfrom
andrebrait:fix/toast-click-marks-read
Oct 10, 2026
Merged

andrebrait merged 3 commits into
kahme247:mainfrom
andrebrait:fix/toast-click-marks-read

Conversation

@andrebrait

Copy link
Copy Markdown
Collaborator

Follow-up to #230 and #218.

Problem

Clicking or tapping an in-app notification toast opens the session it came from, but its entry in the Notifications tab stayed unread and kept counting toward the panel-toggle badge. Following a notification means the user has seen it, so it should be read.

Changes

  • toastHistory.markRead(id) marks one entry read; it is a no-op (no subscriber wake-up) when the entry is gone or already read.
  • The toast card's action, from a click, a tap, or Enter on the focused card, marks the entry read before closing the toast and running the action. The guarded cases (buttons, links, expandable text, drags, swipes, text selection, the dismiss button) still do nothing, so they leave the entry unread.
  • record used to keep the read state of any reused id. Session notifications reuse <sessionId>:<type> as their id, so once a tap marked one read, every later notification of that kind for that session would have arrived already read. Keeping the read state is now opt-in through a keepRead toast option, used by the two update notices (re-announced unchanged on every tab focus).

Not covered: clicking a system (OS) notification. On main those are not in the Notifications tab yet; #240 adds them, and marking them read on click can follow once it lands.

Verification

  • toast.click.test.mjs: a card click and Enter on the card mark the entry read; the guarded interactions leave it unread. Both new assertions fail without the toast.tsx change.
  • toast.test.mjs: after Mark all as read, a session notification with a reused id is unread again, while a keepRead update notice stays read.
  • npm test 1298/1298; typecheck clean; eslint has no errors (only existing warnings in AppShell.tsx).

@andrebrait
andrebrait force-pushed the fix/toast-click-marks-read branch from e42d0f7 to 4bec966 Compare October 10, 2026 07:33
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 10, 2026
…s toast is opened

Squashed from origin/fix/toast-click-marks-read (4bec966) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 10, 2026
…s toast is opened

Squashed from origin/fix/toast-click-marks-read (4bec966) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 10, 2026
…nly pushable notification types

Squashed from origin/feat/notification-read-state (9edf773) onto upstream/main.

Integration fixup: drops kahme247#242's keepRead (update notices are no longer recorded), keeps kahme247#240/kahme247#242's onClick on history entries, and adapts toast.click.test.mjs to the history: true opt-in.
…ks-read

# Conflicts:
#	CHANGELOG.md
#	components/ui/toast.tsx
@andrebrait
andrebrait merged commit 2494f8f into kahme247:main Oct 10, 2026
3 checks passed
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 10, 2026
Resolve the overlap with kahme247#242: drop its keepRead (update notices are no longer recorded), keep onClick on history entries, and opt the click tests into history: true.
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.

1 participant