File tree Expand file tree Collapse file tree 4 files changed +14
-67
lines changed
packages/react-devtools-shared/src Expand file tree Collapse file tree 4 files changed +14
-67
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -11,29 +11,6 @@ import {dehydrate} from '../hydration';
11
11
12
12
import type { DehydratedData } from 'react-devtools-shared/src/devtools/views/Components/types' ;
13
13
14
- export function getSerializableData ( data : any ) {
15
- if ( data === null ) {
16
- return data ;
17
- }
18
- // $FlowFixMe
19
- if ( typeof data === 'bigint' ) {
20
- return data . toString ( ) + 'n' ;
21
- }
22
- if ( Array . isArray ( data ) ) {
23
- return data . reduce ( function ( acc , val ) {
24
- acc . push ( getSerializableData ( val ) ) ;
25
- return acc ;
26
- } , [ ] ) ;
27
- }
28
- if ( typeof data === 'object' ) {
29
- return Object . keys ( data ) . reduce ( function ( acc , key ) {
30
- acc [ key ] = getSerializableData ( data [ key ] ) ;
31
- return acc ;
32
- } , { } ) ;
33
- }
34
- return data ;
35
- }
36
-
37
14
export function cleanForBridge (
38
15
data : Object | null ,
39
16
isPathWhitelisted : ( path : Array < string | number > ) => boolean ,
@@ -49,7 +26,7 @@ export function cleanForBridge(
49
26
path ,
50
27
isPathWhitelisted ,
51
28
) ;
52
-
29
+ console . log ( cleanedData ) ;
53
30
return {
54
31
data : cleanedData ,
55
32
cleaned : cleanedPaths ,
Original file line number Diff line number Diff line change @@ -107,6 +107,8 @@ export function getMetaValueLabel(data: Object): string | null {
107
107
case 'date' :
108
108
case 'symbol' :
109
109
return name ;
110
+ case 'bigint' :
111
+ return `${ name } n` ;
110
112
case 'iterator' :
111
113
return `${ name } (…)` ;
112
114
case 'array_buffer' :
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ const LEVEL_THRESHOLD = 2;
69
69
type PropType =
70
70
| 'array'
71
71
| 'array_buffer'
72
+ | 'bigint'
72
73
| 'boolean'
73
74
| 'data_view'
74
75
| 'date'
@@ -107,6 +108,8 @@ function getDataType(data: Object): PropType {
107
108
108
109
const type = typeof data ;
109
110
switch ( type ) {
111
+ case 'bigint' :
112
+ return 'bigint' ;
110
113
case 'boolean' :
111
114
return 'boolean' ;
112
115
case 'function' :
@@ -231,6 +234,14 @@ export function dehydrate(
231
234
case 'string' :
232
235
return data . length <= 500 ? data : data . slice ( 0 , 500 ) + '...' ;
233
236
237
+ case 'bigint' :
238
+ cleaned . push ( path ) ;
239
+ return {
240
+ inspectable : false ,
241
+ name : data . toString ( ) ,
242
+ type,
243
+ } ;
244
+
234
245
case 'symbol' :
235
246
cleaned . push ( path ) ;
236
247
return {
You can’t perform that action at this time.
0 commit comments