mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
e6c5c9a005
Updates the approach used in ValidateNoSetStateInRender to detect function expressions called during render. We now do the following: * Track function expression which are known to unconditionally call setState themselves- if these functions get called, that’s equivalent to calling setState. We call the validation recursively to compute this. * Track LoadLocal/StoreLocal indirections for such function expressions. * Check CallExpressions where the callee is either a known SetState (via type info) _or_ (new) where the callee is in the set of known-to-setState function expressions. The Set is shared throughout the analysis, so we can even find multiple levels of indirection (see new test case).