File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
packages/devtools/client/components Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,16 @@ const colorMode = getColorMode()
2222const proxy = shallowRef ()
2323const error = shallowRef ()
2424
25+ function isPrimitive(value : any ): boolean {
26+ return [' number' , ' bigint' , ' string' , ' boolean' ].includes (typeof value )
27+ }
28+
2529function clone() {
2630 error .value = undefined
2731 try {
28- if (props .state )
29- proxy .value = JSON .parse (JSON .stringify (props .state || {}))
30- else if (typeof props .state === ' number' || typeof props .state !== ' string' )
31- proxy .value = props .state
32+ proxy .value = isPrimitive (props .state )
33+ ? props .state
34+ : JSON .parse (JSON .stringify (props .state || {}))
3235 }
3336 catch (e ) {
3437 console .error (e )
@@ -44,7 +47,7 @@ onMounted(() => {
4447 watch (
4548 () => [props .revision , props .state ],
4649 ([_ , state ]) => {
47- if (typeof state !== ' number ' && typeof state !== ' string ' )
50+ if (! isPrimitive ( state ) )
4851 deepSync (state , props .state )
4952 else
5053 proxy .value = props .state
You can’t perform that action at this time.
0 commit comments