-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
saga twice calls #1985
Comments
Hi there! You can try tracing which part of the code is dispatching the POST_PRODUCT_API action with Redux Devtools. (You can find a trace tab in which you will see a calling stack of each dispatched action) |
the action is called once, but in saga called twice, I not have any idea, I will shared here my actions @khaliu |
i also have same issue |
If you want, you can share your code and setup in a codesandbox(https://codesandbox.io/) just the important part, to see if I can help |
|
This is my code, in the actions called once, but when entry in postProductAPI function, called twice |
I just did make an alternative solution (gambiarra in brazilian portuguese), with a counter... Does anybody have a better solution?
|
I might be wrong, but if your sagas are being called twice while actions are only being fired once then it's probably a configuration issue (e.g. saga middleware injected twice into Redux) . @Deboracgs can you share your store configs (i.e. the part where you inject sagaMiddleware into createStore)? |
@z0al yes, this probably a issue, but this is weird, because only in this call this is happen, I created another function and this happen twice, I'll share with you later the store config . |
@Deboracgs I had the same issue and the @z0al is right, the problem is in yout store config. |
Had the same problem and fixed it with @z0al 's suggestion My previous store configuration looked like this
And I was using it both in my React
Changed my default export to a single instance of my
|
Have you enabled React.StrictMode in your index.js/ts? |
This fixed my issue of double calls. This was exactly what I was doing. |
Many thanks! you saved me. |
I had the same problem when I transformed my "App.tsx" class Component into a Functional Component.
|
perfect 👍 |
Closing due to inactivity. If this is still an issue please reply and I will reopen. Thanks! |
I am Facing the same issue. and not able to fix by exporting on single line. |
Greetings! Can you share some code so we can better understand the problem? |
`export default function configureStore(initialState = {}, history) {
}` and this is for app.js @neurosnap I added the code |
Can you show us where you are dispatching the action that calls the saga twice? Also, are you using |
Yes I am using react with version: "react": "16.8.6". This is the dispatch call |
Thanks! Could you show us the code that calls the dispatch? I need to understand the full context of your code before diving deeper. |
My saga is calling twice, already put take and takeLatest, but it didn't work.
The another sagas called normal.
The text was updated successfully, but these errors were encountered: