Skip to content

Commit

Permalink
fix: expression trace target
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-gorules committed May 24, 2024
1 parent 0e130e8 commit c6754f0
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import clsx from 'clsx';
import React, { useRef } from 'react';
import { useDrag, useDrop } from 'react-dnd';

import { get } from '../../helpers/utility';
import { CodeEditor } from '../code-editor';
import { type SimulationTraceDataExpression } from '../decision-graph';
import type { ExpressionEntry } from './context/expression-store.context';
import { useExpressionStore } from './context/expression-store.context';

Expand Down Expand Up @@ -105,11 +103,9 @@ export const ExpressionItem: React.FC<ExpressionItemProps> = ({ expression, inde
);
};

type ValueOf<T> = T[keyof T];

const ResultOverlay: React.FC<{ expression: ExpressionEntry }> = ({ expression }) => {
const { trace } = useExpressionStore(({ traceData }) => ({
trace: get<ValueOf<SimulationTraceDataExpression> | undefined>(traceData, expression.key, undefined)?.result,
trace: traceData?.[expression.key]?.result,
}));
if (!trace) {
return null;
Expand Down

0 comments on commit c6754f0

Please sign in to comment.