#2059·prepack

Calling __optimizeReactComponentTree twice leads to very confusing errors

Author: gaearonCreated May 30, 2018Updated Jul 31, 2020
Labelsreact compiler

Occasionally I leave an extra __optimizeReactComponentTree call in the bundle, or tag some component for optimizations that's already optimized via its parent tree. This looks like this in the output:

screen shot 2018-05-30 at 5 25 40 pm

It seems to work okay in some cases, but in other cases I get meaningless messages like this:

Failed to render React component root "MyRoot" due to side-effects from mutating the global object property "props"

You can reproduce this by trying to optimize the root of our internal bundle twice. It's pretty confusing.