Closed
Description
I encountered the same issue as #20640 but using react-devtools
as a stand-alone app instead of from the the browser.
The bottom line is that the profiler becomes unresponsive after any interaction with a heavily loaded react page.
React version:
- React: 17.0.2
- ReactDOM: 17.0.2
- React Devtools: 4.18.0
Steps To Reproduce
- Attach a react-devtools stand-alone (
yarn run react-devtools
) to a session - Start profiling
- Do something on your app that would cause a huge number of updates
- The profiler stops functioning
Diagnostics
I actually went through and found out the origin of the issue, however I am not sure what would be the best approach to fix it.
It seems the the origin is a (very) big incoming message:
That eventually causes a maximum call stack exceeded error:
Coming from util.js:128
:
export function utfDecodeString(array: Array<number>): string {
return String.fromCodePoint(...array);
}
And interestingly enough, doing spread operator with an array with 235124 elements actually causes a Maximum call stack size exceeded
error 😄
I tried replacing the code above with the following replacement and it seems to work:
export function utfDecodeString(array: Array<number>): string {
return array.map(c => String.fromCodePoint(c)).join("")
}