From bb7be5554d33cdc390bfe298851e1ce9392d7712 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 15 Sep 2021 18:13:25 -0400 Subject: [PATCH] Updated the utfDecodeString() method to avoid call stack exceeded error --- packages/react-devtools-shared/src/utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react-devtools-shared/src/utils.js b/packages/react-devtools-shared/src/utils.js index 901aecbac6d06..e47f090c58498 100644 --- a/packages/react-devtools-shared/src/utils.js +++ b/packages/react-devtools-shared/src/utils.js @@ -126,7 +126,11 @@ export function getUID(): number { } export function utfDecodeString(array: Array): string { - return String.fromCodePoint(...array); + // Note that we intentionally map over the Array, + // rather than spreading it (String.fromCodePoint(...array)) + // to avoid exceeding the stack call size in the Babel-generated code. + // See github.com/facebook/react/issues/22293#issuecomment-919551764 + return array.map(char => String.fromCodePoint(char)).join(''); } export function utfEncodeString(string: string): Array {