Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

fix(welcome): close the project switcher before the remove confirmation (#1884)

arookieofcc4b9912036c5
diff --git a/src/features/welcome/ProjectPopup.tsx b/src/features/welcome/ProjectPopup.tsx
index 0dead4f78..8774e2f8c 100644
--- a/src/features/welcome/ProjectPopup.tsx
+++ b/src/features/welcome/ProjectPopup.tsx
@@ -100,7 +100,7 @@ export function ProjectPopup({ anchor, onClose }: ProjectPopupProps) {
const entry = entries[current];
if (entry?.kind === "project" && !entry.open) {
e.preventDefault();
- void askRemoveRecent(entry.m.project);
+ void askRemoveRecent(entry.m.project, onClose);
}
} else if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && (query || e.key !== " ")) {
e.preventDefault();
@@ -153,7 +153,7 @@ export function ProjectPopup({ anchor, onClose }: ProjectPopupProps) {
if (e.kind !== "project" || e.open) return;
ev.preventDefault();
setActive(i);
- showContextMenu(ev, recentMenu(e.m.project, onClose));
+ showContextMenu(ev, recentMenu(e.m.project, onClose, onClose));
}}
>
{e.kind === "action" ? (
diff --git a/src/features/welcome/RecentList.tsx b/src/features/welcome/RecentList.tsx
index bcb96ed3f..9c4f42248 100644
--- a/src/features/welcome/RecentList.tsx
+++ b/src/features/welcome/RecentList.tsx
@@ -32,8 +32,13 @@ import {
import styles from "./Welcome.module.css";
import { tx } from "@/platform/i18n";
-/** IDEA's "Remove Recent Project" confirmation, then removes it from the list. */
-export async function askRemoveRecent(project: RecentProject) {
+/**
+ * IDEA's "Remove Recent Project" confirmation, then removes it from the list.
+ * `before` runs just before the confirmation opens: hosts above the dialog's
+ * layer (a popup) pass their closer so the confirmation is not covered (#1883).
+ */
+export async function askRemoveRecent(project: RecentProject, before?: () => void) {
+ before?.();
const ok = await confirm({
title: "Remove Recent Project",
message: tx`Remove '${project.name}' from the list of recent projects?`,
@@ -108,7 +113,7 @@ export function groupMenu(group: RecentProjectGroup): MenuItem[] {
];
}
-export function recentMenu(project: RecentProject, onOpened?: () => void): MenuItem[] {
+export function recentMenu(project: RecentProject, onOpened?: () => void, onRemove?: () => void): MenuItem[] {
// A remote project has no local folder.
const remote = parseRemoteLocation(project.path);
const items: MenuItem[] = [
@@ -150,7 +155,7 @@ export function recentMenu(project: RecentProject, onOpened?: () => void): MenuI
label: "Remove from Recent Projects…",
icon: "close",
danger: true,
- run: () => void askRemoveRecent(project),
+ run: () => void askRemoveRecent(project, onRemove),
},
];
return remote ? items.filter((i) => !("id" in i && i.id === "reveal")) : items;