Notification: fix message text show

This commit is contained in:
Chika 2022-04-15 10:49:59 +03:00
parent a2e982df6e
commit 13741ec00c
3 changed files with 8 additions and 6 deletions

View File

@ -8,6 +8,7 @@ import Layout from './Layout';
message.config({
top: 70,
maxCount: 3,
});
function App() {

View File

@ -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<ArgsProps> = {
placement: 'bottomRight',
@ -11,7 +10,9 @@ type NotificationOptions = ArgsProps & {
type: keyof NotificationInstance;
};
export const openNotification = debounce((options: NotificationOptions) => {
export const openNotification = (options: NotificationOptions) => {
setTimeout(() => {
if (!options.key) options.key = JSON.stringify(options);
notification[options.type]({ ...defaultOptions, ...options });
}, NOTIFICATION_DEBOUNCE);
}, NOTIFICATION_DEBOUNCE);
};

View File

@ -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;