I’m writing a Cesium/Resium app with ~12000 clickable, animated points.
I’m getting the React warning Maximum update depth exceeded
.
When there are <5000 points, there’s no warning, but somewhere in the 7-8000 range, I tend to see this warning.
When debugging in the browser, my call stack is a lot of recursivelyTraverseMutationEffects
followed by a lot of postMessage (async)
I already eliminated 2 sources of that warning that were silly recursion. I had a useEffect
that was updating its trigger.
Is this warning a sign the app needs to be optimized or a sign that there’s some silly recursive rendering happening?
2
Answers
Yes. It is reasonable to get a React "Maximum update depth exceeded" without accidental recursion. We set the render size to the entities to teeny tiny, and now we can display way more entities before hitting the
Maximum update depth exceeded
warning. Cesium/Resium struggles to render so many pixels while our app is doing other things in the browser. The stack ends up too tall because we're asking for too much, and not because we're causing a bad update loop.This is an error, you need to fix it.
Depending on the full error message, this error means