From 8325b5bb1e0c8d48dbfe5edef89b8c9ae1e2ca4f Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Fri, 23 Jun 2023 18:34:05 +0100 Subject: [PATCH] Add count to duplicate errors (#10920) * Add count to duplicate errors * Lint: Remove unused prop --- .../common/bindings/DrawerBindableInput.svelte | 1 - .../components/overlay/NotificationDisplay.svelte | 4 ++-- packages/client/src/stores/notification.js | 14 +++++++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte b/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte index 7fbbf75a30..dacb076bdb 100644 --- a/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte +++ b/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte @@ -21,7 +21,6 @@ export let allowHelpers = true export let updateOnChange = true export let drawerLeft - export let key const dispatch = createEventDispatcher() let bindingDrawer diff --git a/packages/client/src/components/overlay/NotificationDisplay.svelte b/packages/client/src/components/overlay/NotificationDisplay.svelte index 669fa41a1d..46b3a2a6a1 100644 --- a/packages/client/src/components/overlay/NotificationDisplay.svelte +++ b/packages/client/src/components/overlay/NotificationDisplay.svelte @@ -6,7 +6,7 @@
{#if $notificationStore} - {#each $notificationStore as { type, icon, message, id, dismissable } (id)} + {#each $notificationStore as { type, icon, message, id, dismissable, count } (id)}
1 ? `(${count}) ${message}` : message} {icon} {dismissable} on:dismiss={() => notificationStore.actions.dismiss(id)} diff --git a/packages/client/src/stores/notification.js b/packages/client/src/stores/notification.js index bbde660fd4..2a9f9749ec 100644 --- a/packages/client/src/stores/notification.js +++ b/packages/client/src/stores/notification.js @@ -13,7 +13,13 @@ const createNotificationStore = () => { setTimeout(() => (block = false), timeout) } - const send = (message, type = "info", icon, autoDismiss = true) => { + const send = ( + message, + type = "info", + icon, + autoDismiss = true, + count = 1 + ) => { if (block) { return } @@ -33,6 +39,11 @@ const createNotificationStore = () => { } const _id = id() store.update(state => { + const duplicateError = state.find(err => err.message === message) + if (duplicateError) { + duplicateError.count += 1 + return [...state] + } return [ ...state, { @@ -42,6 +53,7 @@ const createNotificationStore = () => { icon, dismissable: !autoDismiss, delay: get(store) != null, + count, }, ] })