Remove notices after 5 seconds
[MAILPOET-2652]
This commit is contained in:
committed by
Jack Kitterhing
parent
fb3f132b29
commit
c13dcfa380
@@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import { memoize } from 'lodash';
|
||||
import { NoticeList } from '@wordpress/components';
|
||||
import { useDispatch, useSelect } from '@wordpress/data';
|
||||
|
||||
@@ -13,6 +14,11 @@ export default () => {
|
||||
);
|
||||
|
||||
const { removeNotice } = useDispatch('mailpoet-form-editor');
|
||||
const timedRemove = memoize((noticeId) => {
|
||||
setTimeout(() => removeNotice(noticeId), 5000);
|
||||
});
|
||||
|
||||
dismissibleNotices.forEach((notice) => timedRemove(notice.id));
|
||||
|
||||
return (
|
||||
<>
|
||||
|
Reference in New Issue
Block a user