Skip to content

Commit ff6a34f

Browse files
committed
Convert to string before concatenation
The new Temporal (https://github.com/tc39/proposal-temporal) date/time API (currently stage 3) will throw when calling `valueOf` on instances of most Temporal types. This behavior breaks react-dom's rendering of Temporal instances because the current implementation relies on the `+` operator which calls `valueOf`. This commit ensures that values are converted to strings before concatenation is attempted with `+`.
1 parent e9b2028 commit ff6a34f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-dom/src/client/ToStringValue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export opaque type ToStringValue =
1919
// around this limitation, we use an opaque type that can only be obtained by
2020
// passing the value through getToStringValue first.
2121
export function toString(value: ToStringValue): string {
22-
return '' + (value: any);
22+
return '' + String((value: any));
2323
}
2424

2525
export function getToStringValue(value: mixed): ToStringValue {

0 commit comments

Comments
 (0)