Skip to content

fix: keep panel progress active when navigating away during categorization - #49

Merged
Harsh16gupta merged 1 commit into
masterfrom
fix/panel-state-persistence
Aug 23, 2026
Merged

fix: keep panel progress active when navigating away during categorization#49
Harsh16gupta merged 1 commit into
masterfrom
fix/panel-state-persistence

Conversation

@Harsh16gupta

Copy link
Copy Markdown
Collaborator

What was broken? (this was reported by a user on the forum -- I tried to reproduce the bug but was not able to do it.)
If you start the categorization pipeline and navigate away (like opening Tools → Options) while the model is loading or embeddings are being generated, the side panel resets to the initial "No categories yet" screen when you come back.

The pipeline was still running in the background, but the UI completely lost track of it. If a user clicked "Run" again at that point, it would also kick off a second redundant pipeline run.

What changes in this PR?

  1. Prevent double runs: Added a check in setupPanel.ts so if operationState.inProgress is already true, clicking run just returns the current state instead of launching another pipeline.
  2. Proper lifecycle tracking: Marked operationState.inProgress as true on start, and reset it to false inside onComplete and onError.
  3. Fallback state on reconnect: Added a safety net in getInitialState so if the webview queries initial state while a background job is running, it receives a status update rather than an idle state.
  4. Recovery polling on IPC delays: In AppStateContext.tsx, if the initial IPC response is delayed/missed because the main thread is busy loading models/embeddings, the webview will retry polling up to 5 times to catch back up with the running job.

@Harsh16gupta Harsh16gupta self-assigned this Aug 21, 2026
@Harsh16gupta
Harsh16gupta force-pushed the fix/panel-state-persistence branch from 2085a3e to 126364b Compare August 21, 2026 17:37
@Harsh16gupta
Harsh16gupta force-pushed the fix/panel-state-persistence branch from 126364b to 538d99a Compare August 21, 2026 17:59
@Harsh16gupta

Copy link
Copy Markdown
Collaborator Author

I wasn't able to test this as I couldn't reproduce the issue on my device. The changes only add extra guardrails but don't affect any working workflow, so I think we can merge it.

@Harsh16gupta
Harsh16gupta merged commit 70c0740 into master Aug 23, 2026
1 check passed
@Harsh16gupta
Harsh16gupta deleted the fix/panel-state-persistence branch August 26, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant