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
{{ message }}
Repository navigation
Error: performUpdateIfNecessary: Unexpected batch number ... #6895
From maintainers: if you have this problem, please see the explanation in #6895 (comment).
I am getting a strange error I've never come across. Googling it doesn't help at all. Error: performUpdateIfNecessary: Unexcpeted batch number (current 36, pending 31)(...)
It has caused me a lot of headaches. I've reverted to 2 days ago and the error persists, even though 2 days ago everything was running smoothly and all tests were passing.
I would appreciate any sort of direction as to how I can begin to resolve this bug. My guesses are that it's an error with Redux, Webpack, Redux-Form, or React itself. I know, not that precise, but I'm quite lost.
Example redux logger information:
Max OS X, El Capitan 10.11.5
React v15.0.1 (error persists on v15.1.0)
I'm sorry if this isn't specific to React. I did look into the error message code and it appears to be coming from the Facebook/React code.
Ugh, npm ls react breaks because of peer deps. What’s confusing though is you seem to have react-addons-css-transition-group@0.14.8 and react-addons-test-utils@0.14.8. Can you please update these packages to 15.1.0 as well and make sure they don’t contain node_modules/react inside themselves?
Okay, I've upgraded both packages and checked their respective folders in node_modulesto see if they contain their own node_modules/react (which they don't).
I reverted back even further and it finally works. The major package changes were redux-form (v5 -> v6) and some smaller stuff.
Going to keep trying out different packages until I find out what was throwing the issue. Hopefully I post back here soon with the solution for the rare chance someone else has a similar problem.
This sounds like it is probably a bug in React. That invariant is new; it was added in 15.1.0, which was released six days ago. #6650
@brotzky If you can provide a reproducible test case, that would be super helpful. Even if it is part of a larger codebase that you can share (my guess is it is going to be super hard to isolate that example).
Yes, we updated to 15.1.0 yesterday, May 25th. That was when we started getting these new errors.
I will see if I can isolate the issue, but it's very hard to track down. That's the only error message I get. This doesn't break all components, only ones on a specific view. For example, it's the only view that uses <ReactCSSTransitionGroup />.
I got this issue with react-redux-form + React Autocomplete by setting the initial state for a form to be null rather than ''. (Which I really wanted... but it didn't work... oh well set it back to '' and everything "fixed".
I can reproduce a case, likely similar to the original.
OnsenUI 2.0.5 Lazylist does not render and gives the "performUpdateIfNecessary: Unexpected batch number" error after upgrading to Leaflet 1.0.2 & React-Leaflet 1.1.0.
Going back to legacy Leaflet 0.7.7 alleviates the error, and the Lazylist component functions correctly.
This may be out of context, but I came to this issue, because this message popped up while I did a stupid mistake in my React Native code
Inside the view for an onPress event I did this onPress={methodName}
instead of onPress={methodName()}
Posting this just in case help anyone else save some time.
This message popped up when I was working with a SELECT on Redux-Form. Initially, my SELECT was initialised with an empty array as options. But, accidentally, on my action creator I made this:
This was changing the initial type from Array to Object which was unexpected by my reducer & view. After changing the highlighted line to --> let staticData = []; <--
It started working fine.
In this thread, everybody seems to be enumerating all the different possible errors in JavaScript apps. However they are not relevant to solving the issue, and are not helpful to others. This thread focuses on symptoms, but the underlying cause has been explained several times in this and other threads. I'm going to lock this thread to reduce the noise and help people finding this on Google focus on the solution rather than the symptom.
I have explained the solution in #7617 (comment) so please read that comment. This problem most commonly occurs with Promises, but can occur in any code where you catch exceptions and don't log them.
If you see a cryptic error like this it always means there is an earlier error from your component code that causes React to break. You need to scroll your console up and find the original error.
If you don't see an earlier error in your own components, it means that your code is swallowing errors. This is very common if you use catch() with Promises and accidentally swallow errors inside React. I've also seen this with other libraries, like Redux Saga, where people just catch any error without checking if it's a network failure or something else. Some third party libraries may also swallow your errors. I recommend to enable "Break on All Exceptions" in your debugger, and then when the error throws, check the call stack to find who's silently catching your error.
Again, this error itself is just an irrelevant symptom.
You need to figure out why your code crashes in a component, and which catch swallows the crash.
The fact that React produces cryptic errors on next updates after a component crash is unfortunate, and we'll fix this in next versions of React. However, in any case, you need to fix the underlying problem (your code crashing) first.
If you're sure it's a bug in React please file a new issue with a minimal reproducing test case.
A small update on this. We just released React 16 beta which shouldn’t emit cryptic errors like this one. Even if the application code swallows an error, React 16 will still print it to the console. It might be too early for you to try React 16 (since ecosystem is still preparing for it), but this error should never occur in the future after you switch to it.
Activity
gaearon commentedon May 26, 2016
If you scroll up, are there any earlier errors before these ones? You can see them in the
errorfield in Redux logger.brotzky commentedon May 26, 2016
No, those are the first errors.
I'm using react hot loader 3-beta.1 and when I hide and show the side logger I can reproduce the same error over and over.
I think it's an error with one of my dependencies, but not sure which one. Postcss/autoprefixer and redux-form are back on my list of guesses.
edit: I've reverted back 2 weeks and get the same error. I think it has to be my OS or a dependency is failing.
gaearon commentedon May 26, 2016
Does
npm ls reactshow only one copy of React? Can you create a minimal project reproducing the problem?brotzky commentedon May 26, 2016
My package.json specifies
"react": "^15.1.0",gaearon commentedon May 26, 2016
Ugh,
npm ls reactbreaks because of peer deps. What’s confusing though is you seem to havereact-addons-css-transition-group@0.14.8andreact-addons-test-utils@0.14.8. Can you please update these packages to15.1.0as well and make sure they don’t containnode_modules/reactinside themselves?brotzky commentedon May 26, 2016
Okay, I've upgraded both packages and checked their respective folders in
node_modulesto see if they contain their ownnode_modules/react(which they don't).npm ls reactnow returns└── react@15.1.0I still seem to be getting the same error
gaearon commentedon May 26, 2016
Cool. Still having the same issue? At this point only a reduced example would help.
brotzky commentedon May 26, 2016
I reverted back even further and it finally works. The major package changes were redux-form (v5 -> v6) and some smaller stuff.
Going to keep trying out different packages until I find out what was throwing the issue. Hopefully I post back here soon with the solution for the rare chance someone else has a similar problem.
Thanks a lot for the help! @gaearon
jimfb commentedon May 26, 2016
This sounds like it is probably a bug in React. That invariant is new; it was added in 15.1.0, which was released six days ago. #6650
@brotzky If you can provide a reproducible test case, that would be super helpful. Even if it is part of a larger codebase that you can share (my guess is it is going to be super hard to isolate that example).
cc @spicyj
sophiebits commentedon May 26, 2016
Yes, if you can post something that reproduces the problem it would be very helpful.
brotzky commentedon May 26, 2016
Yes, we updated to 15.1.0 yesterday, May 25th. That was when we started getting these new errors.
I will see if I can isolate the issue, but it's very hard to track down. That's the only error message I get. This doesn't break all components, only ones on a specific view. For example, it's the only view that uses
<ReactCSSTransitionGroup />.Here's an entire log I get from start to finish.

brotzky commentedon May 26, 2016
Ive just removed the
redux-formcomponent from the page and it loads fine.redux-form@6.0.0-alpha.13Will continue looking into this. It seems my original suspicion was correct.
react@15.1.0isn't playing nicely withredux-form@6.0.0-alpha.13gaearon commentedon May 26, 2016
@erikras Ever seen this?
brotzky commentedon May 26, 2016
@erikras, when I specifically remove the
Everything works as expected.
41 remaining items
wking commentedon Nov 24, 2016
GetNodes: Shuffle around to return an array of nodes
GetNodes: Shuffle around to return an array of nodes
romansky commentedon Dec 21, 2016
Was able to "reproduce" this issue by simple:
There was no other indication for the generated exception, OP's error ensured.
zargold commentedon Jan 20, 2017
I got this issue with react-redux-form + React Autocomplete by setting the initial state for a form to be
nullrather than''. (Which I really wanted... but it didn't work... oh well set it back to''and everything "fixed".mcku commentedon Jan 23, 2017
I can reproduce a case, likely similar to the original.
OnsenUI 2.0.5 Lazylist does not render and gives the "performUpdateIfNecessary: Unexpected batch number" error after upgrading to Leaflet 1.0.2 & React-Leaflet 1.1.0.
Going back to legacy Leaflet 0.7.7 alleviates the error, and the Lazylist component functions correctly.
In both cases react version was 15.4.2.
ivks commentedon Jan 25, 2017
This may be out of context, but I came to this issue, because this message popped up while I did a stupid mistake in my React Native code
Inside the view for an onPress event I did this
onPress={methodName}instead of
onPress={methodName()}Posting this just in case help anyone else save some time.
osilvaa commentedon Jan 25, 2017
This message popped up when I was working with a SELECT on Redux-Form. Initially, my SELECT was initialised with an empty array as options. But, accidentally, on my action creator I made this:
This was changing the initial type from Array to Object which was unexpected by my reducer & view. After changing the highlighted line to
--> let staticData = []; <--It started working fine.
Redux-Form: 6.1.1 & React 15.3.2
oklas commentedon Feb 21, 2017
This error
appears at some component after error (see #4026)
appears in another component if it have crash at
render()method (for example caused by(undefined).xcode)both components is not parent of each other
gaearon commentedon Feb 21, 2017
In this thread, everybody seems to be enumerating all the different possible errors in JavaScript apps. However they are not relevant to solving the issue, and are not helpful to others. This thread focuses on symptoms, but the underlying cause has been explained several times in this and other threads. I'm going to lock this thread to reduce the noise and help people finding this on Google focus on the solution rather than the symptom.
I have explained the solution in #7617 (comment) so please read that comment. This problem most commonly occurs with Promises, but can occur in any code where you
catchexceptions and don't log them.If you see a cryptic error like this it always means there is an earlier error from your component code that causes React to break. You need to scroll your console up and find the original error.
If you don't see an earlier error in your own components, it means that your code is swallowing errors. This is very common if you use
catch()with Promises and accidentally swallow errors inside React. I've also seen this with other libraries, like Redux Saga, where people justcatchany error without checking if it's a network failure or something else. Some third party libraries may also swallow your errors. I recommend to enable "Break on All Exceptions" in your debugger, and then when the error throws, check the call stack to find who's silently catching your error.Again, this error itself is just an irrelevant symptom.
You need to figure out why your code crashes in a component, and which
catchswallows the crash.The fact that React produces cryptic errors on next updates after a component crash is unfortunate, and we'll fix this in next versions of React. However, in any case, you need to fix the underlying problem (your code crashing) first.
If you're sure it's a bug in React please file a new issue with a minimal reproducing test case.
gaearon commentedon Jul 27, 2017
A small update on this. We just released React 16 beta which shouldn’t emit cryptic errors like this one. Even if the application code swallows an error, React 16 will still print it to the console. It might be too early for you to try React 16 (since ecosystem is still preparing for it), but this error should never occur in the future after you switch to it.