Skip to content

Commit 29ca5a0

Browse files
CATISNOTSODIUMRichDom2185
authored andcommitted
fix(tracer): rendering issue with literal AST
1 parent 45fdca2 commit 29ca5a0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/commons/sideContent/content/SideContentSubstVisualizer.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ type SubstVisualizerPropsAST = {
9494
};
9595

9696
const SideContentSubstVisualizer: React.FC<SubstVisualizerPropsAST> = props => {
97-
console.log(props);
9897
const [stepValue, setStepValue] = useState(1);
9998
const lastStepValue = props.content.length;
10099
const hasRunCode = lastStepValue !== 0;
@@ -245,10 +244,15 @@ function composeStyleWrapper(
245244
*/
246245
function renderNode(currentNode: StepperBaseNode, renderContext: RenderContext): React.ReactNode {
247246
const styleWrapper = renderContext.styleWrapper;
248-
249247
const renderers = {
250248
Literal(node: StepperLiteral) {
251-
return <span className="stepper-literal">{node.raw ? node.raw : node.value}</span>;
249+
const stringifyLiteralValue = (value: any) =>
250+
typeof value === 'string'
251+
? '"' + value + '"'
252+
: value !== null
253+
? value.toString()
254+
: 'null';
255+
return <span className="stepper-literal">{node.raw ? node.raw : stringifyLiteralValue(node.value)}</span>;
252256
},
253257
Identifier(node: StepperIdentifier) {
254258
return <span>{node.name}</span>;

0 commit comments

Comments
 (0)