Skip to content

Commit b4a714c

Browse files
authored
fix: error for displaying result when node is removed (#301)
1 parent 77daf21 commit b4a714c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ui/src/components/nodes/Code.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@ function Timer({ lastExecutedAt }) {
7777

7878
export const ResultBlock = memo<any>(function ResultBlock({ id, layout }) {
7979
const store = useContext(RepoContext)!;
80-
const result = useStore(store, (state) => state.pods[id].result);
81-
const error = useStore(store, (state) => state.pods[id].error);
82-
const stdout = useStore(store, (state) => state.pods[id].stdout);
83-
const running = useStore(store, (state) => state.pods[id].running);
80+
const result = useStore(store, (state) => state.pods[id]?.result);
81+
const error = useStore(store, (state) => state.pods[id]?.error);
82+
const stdout = useStore(store, (state) => state.pods[id]?.stdout);
83+
const running = useStore(store, (state) => state.pods[id]?.running);
8484
const autoLayoutROOT = useStore(store, (state) => state.autoLayoutROOT);
8585
useEffect(() => {
8686
autoLayoutROOT();
8787
}, [running]);
8888
const lastExecutedAt = useStore(
8989
store,
90-
(state) => state.pods[id].lastExecutedAt
90+
(state) => state.pods[id]?.lastExecutedAt
9191
);
9292
const [showOutput, setShowOutput] = useState(true);
9393
const hasResult = useStore(

0 commit comments

Comments
 (0)