From b73e96eb8bf8d05ce1d015770a46c41c7f40359e Mon Sep 17 00:00:00 2001 From: tomymaritano Date: Thu, 23 Apr 2026 14:38:07 -0300 Subject: [PATCH] fix: move useId above early return, remove strict slug check - Modal: move useId() before `if (!open) return null` to prevent React hook order violation on open/close toggle - installFromUrl: remove strict manifest.id === pluginSlug check since marketplace slug and manifest id are not guaranteed to match Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/desktop/src/main/index.ts | 10 +--------- apps/desktop/src/renderer/ui/patterns/Modal.tsx | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/apps/desktop/src/main/index.ts b/apps/desktop/src/main/index.ts index 24470d3..9a026b6 100644 --- a/apps/desktop/src/main/index.ts +++ b/apps/desktop/src/main/index.ts @@ -2403,7 +2403,7 @@ function registerPluginDiscoveryHandlers(): void { }); // Install plugin from a remote URL (marketplace download) - ipcMain.handle('plugins:installFromUrl', async (_event, url: string, pluginSlug: string) => { + ipcMain.handle('plugins:installFromUrl', async (_event, url: string, _pluginSlug: string) => { // Safety: only allow https URLs if (!url.startsWith('https://')) { return { success: false, error: 'Only HTTPS URLs are allowed' }; @@ -2502,14 +2502,6 @@ function registerPluginDiscoveryHandlers(): void { return { success: false, error: 'Invalid manifest: missing id or name' }; } - // Validate manifest.id matches the expected pluginSlug if provided - if (pluginSlug && pluginSlug.length > 0 && manifest.id !== pluginSlug) { - return { - success: false, - error: `Manifest ID "${manifest.id}" does not match expected plugin "${pluginSlug}"`, - }; - } - // Validate plugin ID - only allow alphanumeric, hyphens, underscores if (!/^[a-zA-Z0-9_-]+$/.test(manifest.id)) { return { diff --git a/apps/desktop/src/renderer/ui/patterns/Modal.tsx b/apps/desktop/src/renderer/ui/patterns/Modal.tsx index a090e37..6f587cf 100644 --- a/apps/desktop/src/renderer/ui/patterns/Modal.tsx +++ b/apps/desktop/src/renderer/ui/patterns/Modal.tsx @@ -46,6 +46,7 @@ export function Modal({ ); const contentRef = useRef(null); + const generatedId = useId(); // Focus the modal container on open useEffect(() => { @@ -56,7 +57,6 @@ export function Modal({ if (!open) return null; - const generatedId = useId(); const titleId = title != null ? generatedId : undefined; return createPortal(