From 13741ec00cb30c42716628f8dd202088797d0181 Mon Sep 17 00:00:00 2001 From: Chika Date: Fri, 15 Apr 2022 10:49:59 +0300 Subject: [PATCH] Notification: fix message text show --- src/client/App.jsx | 1 + src/client/Elements/Notification.ts | 11 ++++++----- src/core/constants/debounce.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/client/App.jsx b/src/client/App.jsx index bb4cad6..0756f61 100644 --- a/src/client/App.jsx +++ b/src/client/App.jsx @@ -8,6 +8,7 @@ import Layout from './Layout'; message.config({ top: 70, + maxCount: 3, }); function App() { diff --git a/src/client/Elements/Notification.ts b/src/client/Elements/Notification.ts index c40f1bb..fa4330d 100644 --- a/src/client/Elements/Notification.ts +++ b/src/client/Elements/Notification.ts @@ -1,7 +1,6 @@ import { notification } from 'antd'; import { ArgsProps, NotificationInstance } from 'antd/lib/notification'; import { NOTIFICATION_DEBOUNCE } from 'core/constants/debounce'; -import { debounce } from 'lodash'; const defaultOptions: Partial = { placement: 'bottomRight', @@ -11,7 +10,9 @@ type NotificationOptions = ArgsProps & { type: keyof NotificationInstance; }; -export const openNotification = debounce((options: NotificationOptions) => { - if (!options.key) options.key = JSON.stringify(options); - notification[options.type]({ ...defaultOptions, ...options }); -}, NOTIFICATION_DEBOUNCE); +export const openNotification = (options: NotificationOptions) => { + setTimeout(() => { + if (!options.key) options.key = JSON.stringify(options); + notification[options.type]({ ...defaultOptions, ...options }); + }, NOTIFICATION_DEBOUNCE); +}; diff --git a/src/core/constants/debounce.js b/src/core/constants/debounce.js index fd7ab33..c5adbda 100644 --- a/src/core/constants/debounce.js +++ b/src/core/constants/debounce.js @@ -1,3 +1,3 @@ export const DEFAULT_DEBOUNCE_DELAY = 350; -export const NOTIFICATION_DEBOUNCE = 750; +export const NOTIFICATION_DEBOUNCE = 100; export const ACTION_DELAY = 1200;