cancel execution on file change (#1440)

This commit is contained in:
Kurt Hutten
2024-02-19 09:23:18 +11:00
committed by GitHub
parent 0a4a517bb4
commit 66e62c6037
2 changed files with 37 additions and 2 deletions

View File

@ -36,6 +36,7 @@ import { sep } from '@tauri-apps/api/path'
import { homeCommandBarConfig } from 'lib/commandBarConfigs/homeCommandConfig'
import { useHotkeys } from 'react-hotkeys-hook'
import { isTauri } from 'lib/isTauri'
import { kclManager } from 'lang/KclSingleton'
// This route only opens in the Tauri desktop context for now,
// as defined in Router.tsx, so we can use the Tauri APIs and types.
@ -55,6 +56,7 @@ const Home = () => {
// during the loading of the home page. This is wrapped
// in a single-use effect to avoid a potential infinite loop.
useEffect(() => {
kclManager.cancelAllExecutions()
if (newDefaultDirectory) {
sendToSettings({
type: 'Set Default Directory',