Skip to content

Commit ec15b99

Browse files
committed
avoid recreating pyodide worker
1 parent d12a8b2 commit ec15b99

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/hooks/usePyodideWorker.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ export const useManagedWorker = () => {
1717
}
1818
};
1919

20-
initWorker();
20+
if (workerUuid === null) {
21+
void initWorker();
22+
}
2123

2224
return () => {
2325
if (workerUuid) {
2426
dispatch(terminateWorker(workerUuid));
2527
}
2628
isActive = false;
2729
};
28-
}, [dispatch]);
30+
}, [dispatch, workerUuid]);
2931

3032
return workerUuid;
3133
};

0 commit comments

Comments
 (0)