fix(plugins): New workspace commands have the same effects as a pick, even from a mount effect

The screen attached the pick side effects (remembering the isolation, syncing the picker's PR
attachment) as listeners in its own useEffect, which runs after a child item's mount effect. A
mount-time setIsolation("worktree") switched the screen but was not saved, and setBaseRef skipped
the attachment sync. The effects are now injected when the setup model is built, so a command and
a pick run the same code from the first render. Closing the picker stays in the picker's handler.
This commit is contained in:
Mohamed Boudra
2026-11-04 07:25:21 +01:00
parent 476bb46f42
commit 72d41a9794
7 changed files with 113 additions and 69 deletions
+3 -2
View File
@@ -709,8 +709,9 @@ metadata), so a command is valid from a child's first effect, which runs before
effects. `syncInputs` refreshes those inputs in a layout effect on every commit, and commands read
them when they run, never from the render that built them. The pickers and the commands pick
through the same `chooseBase` and `chooseIsolation`, so a plugin command has the effects of a
pick; the screen supplies those effects (syncing the picker's PR attachment, remembering the
isolation) with `onBaseChosen` and `onIsolationChosen`. Add a capability by extending the store;
pick; the screen injects those effects when it builds the store (syncing the picker's PR attachment,
remembering the isolation), so a command from a mount effect does the same as a click. Closing the
picker stays in the picker's own handler. Add a capability by extending the store;
do not read screen state from a plugin component.
`ensureWorkspace` sends the store's `branch` as `source.branchName` whenever the worktree cuts a