Framework7 Notification: concurrent alerts render simultaneously with no coalescing or max-visible limit
0 reputation · 11 Mar 2020, 16:26 UTC
0 reputation · 11 Mar 2020, 16:26 UTC
Control notification density when multiple alerts are triggered in quick succession — for example, from a debounced network error handler or batched background sync — so that users see a manageable number of distinct messages instead of a stack that obscures actions.
The app.notification.create() API (Framework7 v8/v9) accepts closeTimeout, closeButton, and positioning options per instance, but the framework does not provide a built-in queue, deduplication, or maximum-visible policy. Rapid successive calls each append a .notification element to the shared .notifications-list container; all render at once with fixed offsets and creation-order z-index stacking. No native coalescing exists for identical messages, and dynamic repositioning when one closes is not automatic. The documentation shows no opinionated pattern for composing a queue helper, leaving the decision to the consumer.
NotificationQueue wrapper (tracking a message hash, enforcing maxVisible, and applying a replaceStrategy) the recommended composition pattern, or does the core team plan to introduce a first-party utility in a future release?Framework7 v8/v9 has no documented native notification queue, deduplication, or maxVisible cap, and no first-party utility or roadmap commitment is documented in the available knowledge. The practical composition pattern is a consumer-owned NotificationQueue wrapper around app.notification.create() and instance destruction. Key duplicates by a developer-supplied key, not raw text, and close or replace the oldest notification before appending a new one when the visible limit is reached.
Confirmed from your setup: each app.notification.create() call appends a separate .notification element to .notifications-list. Framework7 applies fixed offsets and creation-order z-index stacking. It does not coalesce identical messages, cap visible items, or reflow remaining notifications when one closes.
Likely explanation: every alert is treated as an independent, long-lived DOM node. closeTimeout schedules individual removal only; it does not coordinate with other pending notifications, so a burst of errors stacks on top of page actions.
push, if the key already exists, return or refresh the existing instance according to your Framework7 version's API instead of appending a duplicate.maxVisible, destroy the oldest entry and remove it from the map before creating the next notification.push({ key, text, ...params }) method and return the instance or a handle.Prefer a developer-supplied key. Exact text is fragile because different errors can share identical copy. Hashing the full parameter object can over-suppress distinct alerts that share text but differ in context, such as retryable versus fatal failures.
requestAnimationFrame if you must measure after changes.closeTimeout and closeButton are per-instance options..notification with no automatic cap..notifications-list to confirm remaining items do not reflow automatically.Are you using vanilla Framework7 or a React/Vue/Svelte integration, and must the queue survive page or route changes? That determines whether the wrapper lives at the app level or is scoped to a single view.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.