-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(manager-react-components): useNotifications prevent early clears #14234
Conversation
await new Promise((resolve) => setTimeout(resolve, 2000)); | ||
|
||
render(<ClearNotifications />); | ||
container = render(<Notifications />).container; | ||
|
||
await waitFor(() => { | ||
expect(container.children.length).toBe(0); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better mock Date.
- It's a unit test we don't test Data.now() method
- This allow to do the test faster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enhanced the tests according to your suggestions
clearNotifications: () => | ||
set((state) => ({ | ||
notifications: state.notifications.filter( | ||
(notification) => Date.now() - notification.creationTimestamp < 1000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(notification) => Date.now() - notification.creationTimestamp < 1000, | |
(notification) => Date.now() - notification.creationTimestamp < DEFAULT_MINIMUN_LIFETIME, |
Optionnal suggestion : Possible to add constant for default minimum lifetime and maybe add parameters if we want more or less on the future ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me the whole api should be reworked, for example we should be able to set "clearAfterRead" per notification instead of for all of them, but I think it should be another subject, right now I'm just trying to be up to date with MRC v1 on this issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI we opened this PR to sync the changes we introduced in MRC 1.x : #14170
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok wasn't aware of that I'll just close this one then
659448e
to
ac4ffbf
Compare
Signed-off-by: Florian Renaut <[email protected]> Signed-off-by: Tristan WAGNER <[email protected]>
ac4ffbf
to
6bbe102
Compare
Quality Gate passedIssues Measures |
should be handled by #14170 |
this is a cherry pick of this commit on mrc v1 maintenance branch
develop
Description
Related