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
We fire toastr add action (by using a @ReduxToastr/toastr/ADD type Redux action) with the following payload in the app (I've made some changes to demonstrate that the message and title and type are definitely the same on all the toastrs we create):
id: getRandomId(), // a function to create a random id, we use this because react-redux-toastr will keep track of the id internally for closing via CustomToastrButton which we need for aria-labels and closing modals with the ESC button
message: 'Aislinn is testing',
options: {
timeOut: 5000,
icon: <NotificationSuccessLge />,
removeOnHover: false,
showCloseButton: false,
component: <CustomToastrButton toastMsgId="toast.closeSuccessToast" />,
preventDuplicates: true,
},
position: 'top-right',
title: 'Aislinn is still testing',
type: 'success',
This method helps to me prevent the duplicates toastrs in react-redux-toastr
Saga file
toastr.warning("Loading", "Please wait while we upload the file.");
toastr.clean(); // clean the previous toastr
toastr.success("Success", "Successfully uploaded the file.");
setTimeout(() => {
toastr.clean(); // clean the toastr after 3 seconds
}, 3000);
index.js
<ReduxToastr
timeOut={2000}
newestOnTop={false}
preventDuplicates={true}
position="top-right"
getState={(state) => state.toastr} // This is the default
transitionIn="fadeIn"
transitionOut="fadeOut"
progressBar
closeOnToastrClick
/>
We have the ReduxToastr component at the root of our app with
preventDuplicates
props set to true:We fire toastr add action (by using a
@ReduxToastr/toastr/ADD
type Redux action) with the following payload in the app (I've made some changes to demonstrate that the message and title and type are definitely the same on all the toastrs we create):preventDuplicates doesn't work for us with these settings. I had a look at the source code for preventDuplication https://github.com/diegoddox/react-redux-toastr/search?q=prevent+duplicates&unscoped_q=prevent+duplicates and I figured having the same message/title/and type should be enough for this. Is there something else I'm missing?
The version of react-redux-toastr we're using is
"5.0.7"
- a little bit out of date but preventDuplicates should work on that.The text was updated successfully, but these errors were encountered: