mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 00:14:54 +00:00
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:
@@ -36,14 +36,16 @@ describe("the base ref a plugin reads", () => {
|
||||
const origin = rows.find((row) => row.kind === "branch" && row.refName.includes("remotes"));
|
||||
if (!origin) throw new Error("expected an origin row");
|
||||
|
||||
const setup = createNewWorkspaceSetup({
|
||||
locked: false,
|
||||
project: { id: "p", name: "repo" },
|
||||
canCreateWorktree: true,
|
||||
supportsMetadata: true,
|
||||
});
|
||||
const chosen: PickerItem[] = [];
|
||||
setup.onBaseChosen((item) => chosen.push(item));
|
||||
const setup = createNewWorkspaceSetup(
|
||||
{
|
||||
locked: false,
|
||||
project: { id: "p", name: "repo" },
|
||||
canCreateWorktree: true,
|
||||
supportsMetadata: true,
|
||||
},
|
||||
{ persistIsolation: () => {}, syncBaseAttachment: (item) => chosen.push(item) },
|
||||
);
|
||||
const read = toPluginNewWorkspace({
|
||||
host: HOST,
|
||||
view: viewOf(origin),
|
||||
|
||||
Reference in New Issue
Block a user