Skip to content

Commit c053704

Browse files
committed
Fix task creation reload in dev
1 parent 897415f commit c053704

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

electron/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ function verifyPreloadAllowlist(): void {
5050
const preloadPath = path.join(__dirname, '..', 'electron', 'preload.cjs');
5151
const preloadSrc = fs.readFileSync(preloadPath, 'utf8');
5252
const enumValues = new Set(Object.values(IPC));
53-
const missing = [...enumValues].filter((v) => !preloadSrc.includes(`"${v}"`));
53+
const hasChannel = (channel: string) =>
54+
preloadSrc.includes(`'${channel}'`) || preloadSrc.includes(`"${channel}"`);
55+
const missing = [...enumValues].filter((v) => !hasChannel(v));
5456
if (missing.length > 0) {
5557
console.warn(
5658
`[preload-sync] IPC channels missing from preload.cjs ALLOWED_CHANNELS: ${missing.join(', ')}`,

electron/vite.config.electron.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1+
import path from 'path';
12
import { defineConfig } from 'vite';
23
import solid from 'vite-plugin-solid';
34

5+
const rootDir = path.resolve(process.cwd());
6+
const siblingWorktreesDir = path.resolve(rootDir, '..');
7+
48
export default defineConfig({
59
base: './',
610
plugins: [solid()],
711
clearScreen: false,
812
server: {
913
port: 1421,
1014
strictPort: true,
15+
watch: {
16+
ignored: (watchedPath) => {
17+
const resolvedPath = path.resolve(watchedPath);
18+
return resolvedPath.startsWith(siblingWorktreesDir) && !resolvedPath.startsWith(rootDir);
19+
},
20+
},
1121
},
1222
});

src/store/tasks.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { produce } from 'solid-js/store';
22
import { invoke } from '../lib/ipc';
33
import { IPC } from '../../electron/ipc/channels';
44
import { store, setStore, updateWindowTitle, cleanupPanelEntries } from './core';
5+
import { saveState } from './persistence';
56
import { setTaskFocusedPanel } from './focus';
67
import { getProject, getProjectPath, getProjectBranchPrefix, isProjectMissing } from './projects';
78
import { setPendingShellCommand } from '../lib/bookmarks';
@@ -125,6 +126,7 @@ export async function createTask(opts: CreateTaskOptions): Promise<string> {
125126
// Mark as busy immediately; terminal output may arrive later.
126127
markAgentSpawned(agentId);
127128
rescheduleTaskStatusPolling();
129+
await saveState();
128130
updateWindowTitle(name);
129131
return result.id;
130132
}
@@ -194,6 +196,7 @@ export async function createDirectTask(opts: CreateDirectTaskOptions): Promise<s
194196

195197
markAgentSpawned(agentId);
196198
rescheduleTaskStatusPolling();
199+
await saveState();
197200
updateWindowTitle(name);
198201
return id;
199202
}

0 commit comments

Comments
 (0)