-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Consider adding a warning if default middlewares run too slow #412
Comments
Yeah, that seems like a reasonable thing to do. Can you go ahead and file a PR against the We can add a config option to both middleware to allow specifying the timeout as well. |
Done in 1.3. |
@matthieudumas I have the same problem, How do you solved it? |
@LuisGarcia9000 The dev check middlewares have done that for the last year or so. Also, we recently updated the middlewares in 1.5.x to run much faster in most cases. Please make sure you are using the latest version of RTK (1.6.2+) |
@markerikson I have updated to RTK 1.6.2, but the problem still remains, even though I have placed:
¿any siggestion? |
You might also want to try |
@LuisGarcia9000 : can you clarify what actual error you're seeing? You haven't shown any details yet. It would also help if you can provide info on what kind of data you're putting into the store, how big it is, what sort of actions are being dispatched, etc. |
@LuisGarcia9000 Hmm. There's no way that a basic dispatch should be taking 4 seconds, and I strongly doubt that the dev check middleware are the problem here. Can you please post a repository or CodeSandbox that shows the problem actually happening? It's likely that there's some other problem going on in the app, but I can't say what might be the cause without seeing the actual code. |
@markerikson ok, I'm going to looking for in another place, maybe my configuration. |
@LuisGarcia9000 configuration would also not be the issue here. Is this maybe an api call that just answers after four seconds? |
@phryneas I don´t know where is the problem but this is only happen on "development", apk is working very fast. |
I've switched to redux toolkit for a new project built with create react app, and encountered a big performance issue during development. Long story short, I was storing large amounts of json in the store and redux toolkit's default dev middlewares (redux-immutable-state-invariant and serializable-state-invariant-middleware) were taking around 400ms to validate each dispatch...
I'm an experienced react/redux developer, yet I didn't know about those middlewares. Chrome profiler didn't prove very useful, and it took me about 2 hours to nail down the problem.
I suspect other people might have the same problem than me. So what would you think about those middlewares to implement a self timer and raise a warning in the console if they take more than a certain time to run (eg 50ms, ie 20 FPS) ?
The text was updated successfully, but these errors were encountered: