You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently investigating issue related to notification not being displayed after route change. Following scenario describes the case:
I have separate route which presents form for adding new entity
When I click "Save" button AJAX request is dispatched and on success of that request I dispatch new notification and immediately change route using history.push('/some-url')
Following pseudo-code presents that:
function onSuccess(data){
dispatch(Notifications.success( .... ));
history.push('/some-url');
}
After route is changed notification is not displayed however notification is still inside Redux store. Also no RNS_HIDE_NOTIFICATION is fired.
When I invoke an action which displays another notification but does not change the route "old" notifications are displayed too what looks like queuing up of notifications.. All notifications disappear after expected time.
I'm relatively new to React and Redux and I'm trying to build minimal app which reproduces that issue but maybe you could figure out faster what's going on.
The text was updated successfully, but these errors were encountered:
I found cause of an issue. I used Route component higher in component hierarchy than Notifications component. That caused need of mounting Notifications component every time route was changed.
Here is sample pseudo code:
In source code of Notifications you refresh messages only on componentWillReceiveProps so when Notifications is freshly mounted componentWillReceiveProps is not called.
There are two possible solutions for that:
Use Notifications above Route component so changing route does not cause remounting of it:
Thank you for reporting the detailed use case, I'm really glad that you are finding the lib as useful.
I agree that we should add behavior of updating the notifications on will/didmount as you suggested.
I'm currently investigating issue related to notification not being displayed after route change. Following scenario describes the case:
history.push('/some-url')
Following pseudo-code presents that:
Here's list of dependencies:
I'm relatively new to React and Redux and I'm trying to build minimal app which reproduces that issue but maybe you could figure out faster what's going on.
The text was updated successfully, but these errors were encountered: