Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(plugins): register PluginDetailSheet blocking overlay and fix contract test

ZxlDragonDoctor6a3d196acb57
diff --git a/apps/desktop/src/features/plugins/PluginDetailSheet.tsx b/apps/desktop/src/features/plugins/PluginDetailSheet.tsx
index bfed34d75..c21a309a2 100644
--- a/apps/desktop/src/features/plugins/PluginDetailSheet.tsx
+++ b/apps/desktop/src/features/plugins/PluginDetailSheet.tsx
@@ -1,4 +1,6 @@
+import type { ReactNode } from "react";
import { Button, TooltipButton, cx, portalOverlay } from "../../components/ui";
+import { useBlockingOverlay } from "../../lib/blocking-overlay";
import {
IconCheck,
IconLink,
@@ -22,6 +24,11 @@ import {
} from "./model";
import type { PluginsPageModel } from "./usePluginsPage";
+function PluginDetailBlockingHost({ children }: { children: ReactNode }) {
+ useBlockingOverlay();
+ return <>{children}</>;
+}
+
export function PluginDetailSheet({
t,
locale,
@@ -42,6 +49,7 @@ export function PluginDetailSheet({
}: PluginsPageModel) {
return selectedId
? portalOverlay(
+ <PluginDetailBlockingHost>
<div className="plugins-sheet-layer">
<button
type="button"
@@ -353,7 +361,8 @@ export function PluginDetailSheet({
</>
)}
</aside>
- </div>,
+ </div>
+ </PluginDetailBlockingHost>,
)
: null;
}
diff --git a/apps/desktop/test/settings-dialog-overlay.test.mjs b/apps/desktop/test/settings-dialog-overlay.test.mjs
index 650780f25..ad876e8b6 100644
--- a/apps/desktop/test/settings-dialog-overlay.test.mjs
+++ b/apps/desktop/test/settings-dialog-overlay.test.mjs
@@ -76,9 +76,26 @@ test("settings overlays mount on a viewport-fixed host outside the app shell", a
const pluginDialogs = await read("../src/features/plugins/PluginDialogs.tsx");
assert.equal(
- pluginDialogs.match(/portalOverlay\(/g)?.length,
+ pluginDialogs.match(/pluginModalPortal\(/g)?.length,
3,
- "each route-owned plugin modal must mount on the overlay host",
+ "each route-owned plugin modal must mount through pluginModalPortal",
+ );
+ assert.match(
+ pluginDialogs,
+ /function pluginModalPortal[\s\S]*portalOverlay\(/,
+ "pluginModalPortal must wrap portalOverlay",
+ );
+ assert.match(
+ pluginDialogs,
+ /PluginModalBlockingHost[\s\S]*useBlockingOverlay\(/,
+ "plugin modal host must register useBlockingOverlay",
+ );
+
+ const detailSheet = await read("../src/features/plugins/PluginDetailSheet.tsx");
+ assert.match(
+ detailSheet,
+ /useBlockingOverlay\(/,
+ "PluginDetailSheet must register useBlockingOverlay while open",
);
});