Skip to content

feat(Notifications): swap snackbar notifications after minDisplayMs dwell #3196

Open
MartinCupela wants to merge 3 commits into
masterfrom
feat/notification-min-display
Open

feat(Notifications): swap snackbar notifications after minDisplayMs dwell #3196
MartinCupela wants to merge 3 commits into
masterfrom
feat/notification-min-display

Conversation

@MartinCupela
Copy link
Copy Markdown
Contributor

@MartinCupela MartinCupela commented May 19, 2026

🎯 Goal

Closes REACT-984

Introduces:

  • min display time for a snackbar notification to prevent waiting too long to display concurrent notifications (swaps faster by default if the queue is not empty)
  • possibility to introduce custom policy for notification retrieval from the queue

The reduction of display time is introduced according to the design requirements:

Concurrency
- Repeated triggers of the same snackbar replace the active one and reset the auto-dismiss timer.
- A new snackbar replaces the current one rather than queueing behind it.
- Persistent variants (with an action like "Retry") are not replaced by transient feedback. They stay until dismissed or acted on.
- Snackbars do not stack visually.

Documented changes:

https://github.com/GetStream/docs-content/pull/1295

NotificationList now replaces the active snackbar with the next queued one
once it has been visible for `minDisplayMs` (default 1000ms), instead of
waiting for the full `duration` to elapse.

- Same-type repeated triggers refresh the active snackbar and reset its
  auto-dismiss timer (bypass the dwell).
- Persistent variants (no `duration`) are never displaced by transient
  feedback; only a newer persistent or an external dismissal can replace
  them.
- Selection policy is pluggable via the new `pickNext` prop
  (`PickNextNotification`); the default `defaultPickNext` is FIFO so
  nothing is silently dropped. `pickOldest` and `pickNewest` are exported
  as building blocks for custom strategies.
@github-actions
Copy link
Copy Markdown

Size Change: +1.83 kB (+0.27%)

Total Size: 683 kB

📦 View Changed
Filename Size Change
dist/cjs/index.js 272 kB +905 B (+0.33%)
dist/es/index.mjs 270 kB +922 B (+0.34%)
ℹ️ View Unchanged
Filename Size
dist/cjs/audioProcessing.js 1.32 kB
dist/cjs/emojis.js 3.01 kB
dist/cjs/mp3-encoder.js 1.27 kB
dist/cjs/useNotificationApi.js 45.4 kB
dist/css/emoji-picker.css 178 B
dist/css/emoji-replacement.css 456 B
dist/css/index.css 39.7 kB
dist/es/audioProcessing.mjs 1.31 kB
dist/es/emojis.mjs 2.52 kB
dist/es/mp3-encoder.mjs 756 B
dist/es/useNotificationApi.mjs 45.2 kB

compressed-size-action

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

❌ Patch coverage is 96.12403% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.83%. Comparing base (20e554a) to head (0264719).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
src/components/Notifications/NotificationList.tsx 96.12% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3196      +/-   ##
==========================================
+ Coverage   83.68%   83.83%   +0.14%     
==========================================
  Files         435      435              
  Lines       13028    13166     +138     
  Branches     4202     4252      +50     
==========================================
+ Hits        10903    11038     +135     
- Misses       2125     2128       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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