You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constprintableObject={};// The key:value properties of printableObject will be rendered in the JSON Tree
32
+
33
+
if(!dataObj){
34
+
// If state is null rather than an object, print "State: null" in tooltip
35
+
printableObject[containerName]=dataObj;
36
+
}else{
37
+
/*
38
+
Props often contain circular references.
39
+
Messages from the backend must be sent as JSON objects (strings).
40
+
JSON objects can't contain circular ref's, so the backend filters out problematic values by stringifying the values of object properties and ignoring any values that fail the conversion due to a circular ref. The following logic converts these values back to JS so they display clearly and are collapsible.
41
+
*/
42
+
constdata={};
43
+
//ignored false vs true
44
+
//ignored reasons here
45
+
//&& key = name? / order?
46
+
for(constkeyindataObj){
47
+
console.log('keys in dataObj in tooltiptotalDisplay: ',key);
48
+
if(key==='properties'||key==='ignored'||key==='ignoredReasons'){// loop through properties, adding them to the data object
49
+
50
+
if(typeofdataObj[key]==='string'){
51
+
//if 'key' is ignored, put the ignored key and its value on the data object
52
+
//if ignoredReasons has length it should loop through adding the reasons names to the data object
53
+
//actually might only need to give it the properties and ignored and ignored reasons and it'll take care of the rest
54
+
try{
55
+
data[key]=JSON.parse(dataObj[key]);
56
+
}catch{
57
+
data[key]=dataObj[key];
58
+
}
59
+
}else{
60
+
data[key]=dataObj[key];
61
+
}
62
+
}
63
+
}
64
+
/*
65
+
Adds container name (State, Props, future different names for hooks) at top of object so everything nested in it will collapse when you click on it.
data={printableObject}// data to be rendered, a snapshot object
74
+
theme={{extend: colors,tree: ()=>({className: `tooltipData-JSONTree`})}}// theme set to a base16 theme that has been extended to include "className: 'json-tree'"
75
+
shouldExpandNodeInitially={()=>true}// determines if node should be expanded when it first renders (root is expanded by default)
0 commit comments