mirror of
https://github.com/zebrajr/react.git
synced 2025-12-07 12:20:38 +01:00
Summary: This PR expands the analysis from the previous in the stack in order to also capture when a value can incorrectly change within a single render, rather than just changing between two renders. In the case where dependencies have changed and so a new value is being computed, we now compute the value twice and compare the results. This would, for example, catch when we call Math.random() in render.
The generated code is a little convoluted, because we don't want to have to traverse the generated code and substitute variable names with new ones. Instead, we save the initial value to the cache as normal, then run the computation block again and compare the resulting values to the cached ones. Then, to make sure that the cached values are identical to the computed ones, we reassign the cached values into the output variables.
ghstack-source-id:
|
||
|---|---|---|
| .. | ||
| src | ||
| package.json | ||
| rollup.config.js | ||
| tsconfig.json | ||