Skip to content

Commit 4f3e13d

Browse files
authored
Merge pull request #302 from aidxun/aidxun/fix-quit-helmor-onboarding
fix: enable quit flow during onboarding
2 parents 8f39bca + 39ce852 commit 4f3e13d

3 files changed

Lines changed: 40 additions & 1 deletion

File tree

.changeset/quiet-badgers-quit.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"helmor": patch
3+
---
4+
5+
Fix Quit Helmor from the macOS app menu during onboarding so the app exits normally before the main workspace shell is loaded.

src/App.shortcuts.test.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { invoke } from "@tauri-apps/api/core";
12
import {
23
cleanup,
34
fireEvent,
@@ -955,6 +956,35 @@ describe("App global navigation shortcuts", () => {
955956
});
956957
});
957958

959+
it("quits from onboarding when Rust emits quit-requested", async () => {
960+
const invokeMock = vi.mocked(invoke);
961+
const baseInvokeImpl = invokeMock.getMockImplementation();
962+
invokeMock.mockImplementation(
963+
async (command: string, ...args: unknown[]) => {
964+
if (command === "get_app_settings") {
965+
return {
966+
"app.onboarding_completed": "false",
967+
};
968+
}
969+
return baseInvokeImpl?.(command, args[0] as undefined);
970+
},
971+
);
972+
973+
try {
974+
apiMocks.requestQuit.mockReset();
975+
render(<App />);
976+
await screen.findByLabelText("Helmor onboarding");
977+
978+
emitTauriEvent("helmor://quit-requested");
979+
980+
await waitFor(() => {
981+
expect(apiMocks.requestQuit).toHaveBeenCalledWith(false);
982+
});
983+
} finally {
984+
invokeMock.mockImplementation(baseInvokeImpl ?? (async () => undefined));
985+
}
986+
});
987+
958988
it("closes the current session when macOS emits the close-current-session event", async () => {
959989
await renderAppReady();
960990

src/App.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ import { StreamingFooterOverlapScenario } from "./test/e2e-scenarios/streaming-f
137137

138138
const SETTINGS_RELOAD_EVENT = "helmor:reload-settings";
139139
const OPEN_SETTINGS_EVENT = "helmor:open-settings";
140+
const EMPTY_SENDING_SESSION_IDS = new Set<string>();
140141

141142
function App() {
142143
const e2eScenario =
@@ -306,7 +307,10 @@ function MainApp() {
306307
}}
307308
>
308309
{appSettings === null ? null : !appSettings.onboardingCompleted ? (
309-
<AppOnboarding onComplete={completeOnboarding} />
310+
<>
311+
<AppOnboarding onComplete={completeOnboarding} />
312+
<QuitConfirmDialog sendingSessionIds={EMPTY_SENDING_SESSION_IDS} />
313+
</>
310314
) : (
311315
<AppShell
312316
onOpenSettings={(workspaceId, workspaceRepoId) => {

0 commit comments

Comments
 (0)