Skip to content

Commit ebf7ee2

Browse files
littlekirkycodelittlekirkycode
andauthored
fix: Onboarding persistence and update interval (#1251)
Co-authored-by: littlekirkycode <littlekirky@googlemail.com>
1 parent dd60249 commit ebf7ee2

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

apps/code/src/main/services/updates/service.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -686,21 +686,21 @@ describe("UpdatesService", () => {
686686
expect(mockAutoUpdater.checkForUpdates).toHaveBeenCalled();
687687
});
688688

689-
it("performs check every hour", async () => {
689+
it("performs check every 24 hours", async () => {
690690
await initializeService(service);
691691

692692
const initialCallCount =
693693
mockAutoUpdater.checkForUpdates.mock.calls.length;
694694

695-
// Advance 1 hour
696-
await vi.advanceTimersByTimeAsync(60 * 60 * 1000);
695+
// Advance 24 hours
696+
await vi.advanceTimersByTimeAsync(24 * 60 * 60 * 1000);
697697

698698
expect(mockAutoUpdater.checkForUpdates.mock.calls.length).toBe(
699699
initialCallCount + 1,
700700
);
701701

702-
// Advance another hour
703-
await vi.advanceTimersByTimeAsync(60 * 60 * 1000);
702+
// Advance another 24 hours
703+
await vi.advanceTimersByTimeAsync(24 * 60 * 60 * 1000);
704704

705705
expect(mockAutoUpdater.checkForUpdates.mock.calls.length).toBe(
706706
initialCallCount + 2,

apps/code/src/main/services/updates/service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class UpdatesService extends TypedEventEmitter<UpdatesEvents> {
2222
private static readonly SERVER_HOST = "https://update.electronjs.org";
2323
private static readonly REPO_OWNER = "PostHog";
2424
private static readonly REPO_NAME = "code";
25-
private static readonly CHECK_INTERVAL_MS = 60 * 60 * 1000; // 1 hour
25+
private static readonly CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24 hours
2626
private static readonly CHECK_TIMEOUT_MS = 60 * 1000; // 1 minute timeout for checks
2727
private static readonly DISABLE_ENV_FLAG = "ELECTRON_DISABLE_AUTO_UPDATE";
2828
private static readonly SUPPORTED_PLATFORMS = ["darwin", "win32"];

apps/code/src/renderer/features/auth/stores/authStore.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,6 @@ export const useAuthStore = create<AuthState>()(
966966
needsProjectSelection: false,
967967
needsScopeReauth: false,
968968
hasCodeAccess: null,
969-
hasCompletedOnboarding: false,
970969
selectedPlan: null,
971970
selectedOrgId: null,
972971
});

apps/code/src/renderer/features/settings/components/sections/AdvancedSettings.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useAuthStore } from "@features/auth/stores/authStore";
12
import { SettingRow } from "@features/settings/components/SettingRow";
23
import { useSettingsStore } from "@features/settings/stores/settingsStore";
34
import { useFeatureFlag } from "@hooks/useFeatureFlag";
@@ -15,6 +16,20 @@ export function AdvancedSettings() {
1516

1617
return (
1718
<Flex direction="column">
19+
<SettingRow
20+
label="Reset onboarding"
21+
description="Re-run the onboarding tutorial on next app restart"
22+
>
23+
<Button
24+
variant="soft"
25+
size="1"
26+
onClick={() =>
27+
useAuthStore.setState({ hasCompletedOnboarding: false })
28+
}
29+
>
30+
Reset
31+
</Button>
32+
</SettingRow>
1833
<SettingRow
1934
label="Clear application storage"
2035
description="This will remove all locally stored application data"

0 commit comments

Comments
 (0)