From 09ac18db8204e0057a6cf0f73424e4345f2070ab Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 17 Feb 2026 16:08:39 -0800 Subject: [PATCH] Refactor PR opening logic in GitActionsControl component - Simplify the promise handling for opening PR links by directly using `void api.shell.openExternal(prUrl).catch(...)` - Enhance error handling by adding a toast notification for failure cases, improving user feedback on PR link issues --- apps/web/src/components/GitActionsControl.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/web/src/components/GitActionsControl.tsx b/apps/web/src/components/GitActionsControl.tsx index e30ff30dfcdfc3ccb14666f7b5e7f0ee05ae9671..68599e0aace177d17ca41d7bc58df7d554ca0296 100644 --- a/apps/web/src/components/GitActionsControl.tsx +++ b/apps/web/src/components/GitActionsControl.tsx @@ -226,17 +226,14 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp }); return; } - const promise = api.shell.openExternal(prUrl); - toastManager.promise(promise, { - loading: { title: "Opening PR...", data: threadToastData }, - success: { title: "PR opened", data: threadToastData }, - error: (err) => ({ + void api.shell.openExternal(prUrl).catch((err) => { + toastManager.add({ + type: "error", title: "Unable to open PR link", description: err instanceof Error ? err.message : "An error occurred.", data: threadToastData, - }), + }); }); - void promise.catch(() => undefined); }, [api, gitStatusForActions?.openPr?.url, threadToastData]); const runGitActionWithToast = useCallback( -- 2.54.0