Skip to content

Commit bb7be55

Browse files
author
Brian Vaughn
committed
Updated the utfDecodeString() method to avoid call stack exceeded error
1 parent a8cabb5 commit bb7be55

File tree

1 file changed

+5
-1
lines changed
  • packages/react-devtools-shared/src

1 file changed

+5
-1
lines changed

packages/react-devtools-shared/src/utils.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ export function getUID(): number {
126126
}
127127

128128
export function utfDecodeString(array: Array<number>): string {
129-
return String.fromCodePoint(...array);
129+
// Note that we intentionally map over the Array,
130+
// rather than spreading it (String.fromCodePoint(...array))
131+
// to avoid exceeding the stack call size in the Babel-generated code.
132+
// See github.com/facebook/react/issues/22293#issuecomment-919551764
133+
return array.map(char => String.fromCodePoint(char)).join('');
130134
}
131135

132136
export function utfEncodeString(string: string): Array<number> {

0 commit comments

Comments
 (0)