Skip to content

Commit 1c85c8e

Browse files
committed
fix: copytoclipboard support bigint
1 parent d6d5707 commit 1c85c8e

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

packages/react-devtools-shared/src/backend/legacy/renderer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,9 @@ export function attach(
679679
function copyElementPath(id: number, path: Array<string | number>): void {
680680
const inspectedElement = inspectElementRaw(id);
681681
if (inspectedElement !== null) {
682-
copyToClipboard(getInObject(inspectedElement, path));
682+
copyToClipboard(
683+
formatDataForPreview(getInObject(inspectedElement, path), true),
684+
);
683685
}
684686
}
685687

@@ -747,7 +749,7 @@ export function attach(
747749

748750
const element = internalInstance._currentElement;
749751
if (element !== null) {
750-
props = formatDataForPreview(element.props, false);
752+
props = element.props;
751753
source = element._source != null ? element._source : null;
752754

753755
let owner = element._owner;

packages/react-devtools-shared/src/backend/renderer.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,7 @@ export function attach(
23832383
// TODO Review sanitization approach for the below inspectable values.
23842384
context,
23852385
hooks,
2386-
props: formatDataForPreview(memoizedProps, false),
2386+
props: memoizedProps,
23872387
state: usesHooks ? null : memoizedState,
23882388

23892389
// List of owners
@@ -2532,9 +2532,12 @@ export function attach(
25322532

25332533
if (isCurrent) {
25342534
copyToClipboard(
2535-
getInObject(
2536-
((mostRecentlyInspectedElement: any): InspectedElement),
2537-
path,
2535+
formatDataForPreview(
2536+
getInObject(
2537+
((mostRecentlyInspectedElement: any): InspectedElement),
2538+
path,
2539+
),
2540+
true,
25382541
),
25392542
);
25402543
}

packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const immutable = Immutable.fromJS({
3131
xyz: 1,
3232
},
3333
});
34+
// eslint-disable-next-line no-undef
35+
const bigInt = BigInt(123);
3436

3537
export default function UnserializableProps() {
3638
return (
@@ -43,6 +45,7 @@ export default function UnserializableProps() {
4345
setOfSets={setOfSets}
4446
typedArray={typedArray}
4547
immutable={immutable}
48+
bigInt={bigInt}
4649
/>
4750
);
4851
}

0 commit comments

Comments
 (0)