Skip to content

Commit e25c836

Browse files
committed
fix: minor improvements
1 parent 60e72db commit e25c836

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

frontend/src/components/visual-editor/hooks/useVisualEditor.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,19 @@ const VisualEditorProvider: React.FC<VisualEditorContextProps> = ({
349349
}
350350
}
351351

352-
async function handleHighlightFlow(payload: any) {
352+
async function handleHighlightFlow(payload: {
353+
flowId: string;
354+
blockId: string;
355+
userId: string;
356+
}) {
353357
await removeHighlights();
354358

355359
await redirectToTriggeredFlow(selectedCategoryId, payload.flowId);
356360

357361
setTimeout(() => {
358-
const block = engine?.getModel().getNode(payload.blockId) as NodeModel;
362+
const block = engine?.getModel().getNode(payload.blockId) as
363+
| NodeModel
364+
| undefined;
359365

360366
if (!block) {
361367
return;
@@ -372,12 +378,18 @@ const VisualEditorProvider: React.FC<VisualEditorContextProps> = ({
372378
}, 200);
373379
}
374380

375-
async function handleHighlightErroredBlock(payload: any) {
381+
async function handleHighlightErroredBlock(payload: {
382+
flowId: string;
383+
blockId: string;
384+
userId: string;
385+
}) {
376386
await removeHighlights();
377387

378388
await redirectToTriggeredFlow(selectedCategoryId, payload.flowId);
379389
setTimeout(() => {
380-
const block = engine?.getModel().getNode(payload.blockId) as NodeModel;
390+
const block = engine?.getModel().getNode(payload.blockId) as
391+
| NodeModel
392+
| undefined;
381393

382394
if (!block) {
383395
return;
@@ -390,7 +402,7 @@ const VisualEditorProvider: React.FC<VisualEditorContextProps> = ({
390402
block.setHasErrored(true);
391403

392404
engine.repaintCanvas();
393-
}, 220);
405+
}, 200);
394406
}
395407
useSubscribe("highlight:block", handleHighlightFlow);
396408

0 commit comments

Comments
 (0)