Speed up task open paths#95
Conversation
|
CI fix note: the red I added a focused follow-up fix here: cf083f0 After that commit, PR checks pass: |
| buildTaskDetailDataFromSnapshot({ | ||
| task, | ||
| tasks, | ||
| projects, | ||
| tags, | ||
| taskTagIds: taskTags.get(taskId) ?? [], | ||
| projectPathMissing: task.project_id === selectedProjectId ? projectPathMissing : false | ||
| }) |
There was a problem hiding this comment.
Wrong path status This snapshot only carries the cached
projectPathMissing value when the opened task belongs to the currently selected project. The sidebar can open tasks from other projects, so a task whose own project path is missing gets primed with projectPathMissing: false and the detail page renders repo-dependent UI before its async recheck corrects the state.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/apps/app/src/renderer/src/App.tsx
Line: 671-678
Comment:
**Wrong path status** This snapshot only carries the cached `projectPathMissing` value when the opened task belongs to the currently selected project. The sidebar can open tasks from other projects, so a task whose own project path is missing gets primed with `projectPathMissing: false` and the detail page renders repo-dependent UI before its async recheck corrects the state.
How can I resolve this? If you propose a fix, please make it concise.| export function useKnownTaskTerminalState(taskId: string): TerminalState | undefined { | ||
| const activeTaskIds = useActiveTaskIds() | ||
| const shouldSubscribe = activeTaskIds.has(taskId) | ||
| const sessionId = `${taskId}:${taskId}` | ||
| const { getState, subscribeState } = usePty() | ||
| const [terminalState, setTerminalState] = useState<TerminalState | undefined>(() => | ||
| shouldSubscribe ? getState(sessionId) : undefined | ||
| ) | ||
|
|
||
| useEffect(() => { | ||
| if (!shouldSubscribe) { | ||
| setTerminalState(undefined) | ||
| return | ||
| } | ||
|
|
||
| setTerminalState(getState(sessionId)) | ||
| return subscribeState(sessionId, (newState) => setTerminalState(newState)) | ||
| }, [shouldSubscribe, sessionId, getState, subscribeState]) |
There was a problem hiding this comment.
Terminal errors disappear This hook only returns a state while
activeTaskIds contains the task, but that set only tracks alive terminals (running and idle). When a terminal enters error or dead, kanban cards and list rows now receive undefined and hide the red/stopped indicator that the previous direct subscription could display.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/domains/terminal/src/client/PtyContext.tsx
Line: 629-646
Comment:
**Terminal errors disappear** This hook only returns a state while `activeTaskIds` contains the task, but that set only tracks alive terminals (`running` and `idle`). When a terminal enters `error` or `dead`, kanban cards and list rows now receive `undefined` and hide the red/stopped indicator that the previous direct subscription could display.
How can I resolve this? If you propose a fix, please make it concise.
Summary
Optimizes opening a task from the sidebar by:
Root Cause
Opening a task from the sidebar could still suspend on task detail data even when the current app state already had enough task, project, panel, and browser-tab data to render the detail page. Some adjacent open paths also rebuilt lookup state or re-rendered more work than needed.
Fix Details
SuspenseCache.prime(...)so known resolved data can enter the cache without throwing a pending promise.Performance Numbers Seen
Focused scenario:
open-closed-task-from-sidebar.Before:
After:
Validation
In the fresh worktree/branch:
pnpm install --frozen-lockfilepnpm --filter @slayzone/app typecheckpnpm --filter @slayzone/app exec vitest run --root ../../.. packages/shared/suspense/src/suspense-cache.test.tsx packages/domains/task/src/client/taskDetailCache.test.tsEarlier validation from the source branch:
npx playwright test --config playwright.config.ts e2e/perf/scenarios.spec.ts -g open-closed-task-from-sidebarpnpm build:macCI Note
The initial PR run failed in
check-windowsinsidepackages/shared/platform, not in the performance code. Latestmainhad the samecheck-windowsplatform failures on May 23, 2026. This PR includes a small follow-up fix to make those platform shell tests portable on Windows:Greptile Summary
This PR speeds up task-opening paths by priming task detail data and reducing repeated lookup work. The main changes are:
Confidence Score: 3/5
These issues should be fixed before merging.
Focus on
App.tsx,PtyContext.tsx, andCreateTaskDialog.tsx.Important Files Changed
Comments Outside Diff (1)
packages/domains/task/src/client/CreateTaskDialog.tsx, line 39-48 (link)projectsnow defaults to an empty array, and the dialog always passes that array intoProjectSelect. SinceProjectSelecttreats any provided array as controlled and skips loading from the DB, any caller that omitsprojectsgets an empty project dropdown instead of the previous self-loading behavior.Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "fix(platform): make shell tests portable" | Re-trigger Greptile