Skip to content

Commit 9d89f43

Browse files
Copilotsawka
andauthored
Complete onboarding preview coverage for init/telemetry-star flow and align preview state wiring (#2965)
The onboarding preview was missing the first two pages in the new-install flow (`InitPage` and `NoTelemetryStarPage`). This update adds those views to the preview and aligns state access with the current store pattern so they render correctly in preview mode. - **Preview coverage** - Added `InitPage` and `NoTelemetryStarPage` to `frontend/preview/previews/onboarding.preview.tsx` so the full early onboarding path is visible in the preview server. - **Settings access modernization** - Replaced full `settingsAtom` usage in `InitPage` with targeted `useSettingsKeyAtom("telemetry:enabled")`. - Removes broad settings dependency and uses the existing preview-safe settings path. - **Preview bootstrap state init** - Added `ClientModel.getInstance().initialize(null)` in `frontend/preview/preview.tsx` to ensure `clientAtom` is initialized in preview runtime without backend client data. ```tsx // onboarding.tsx const telemetrySetting = useSettingsKeyAtom("telemetry:enabled"); const clientData = useAtomValue(ClientModel.getInstance().clientAtom); const [telemetryEnabled, setTelemetryEnabled] = useState<boolean>(!!telemetrySetting); // preview.tsx setWaveWindowType("preview"); ClientModel.getInstance().initialize(null); ``` - **<screenshot>** - ![Onboarding preview](https://github.com/user-attachments/assets/bf1aeb3d-3fd0-4169-bd3b-a79e1a865ca8) <!-- START COPILOT CODING AGENT TIPS --> --- 🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
1 parent 4ec09cb commit 9d89f43

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

frontend/app/onboarding/onboarding.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Button } from "@/app/element/button";
66
import { FlexiModal } from "@/app/modals/modal";
77
import { OnboardingFeatures } from "@/app/onboarding/onboarding-features";
88
import { ClientModel } from "@/app/store/client-model";
9-
import { atoms } from "@/app/store/global";
9+
import { useSettingsKeyAtom } from "@/app/store/global";
1010
import { disableGlobalKeybindings, enableGlobalKeybindings, globalRefocus } from "@/app/store/keymodel";
1111
import { modalsModel } from "@/app/store/modalmodel";
1212
import * as WOS from "@/app/store/wos";
@@ -29,13 +29,13 @@ type PageName = "init" | "notelemetrystar" | "features";
2929
const pageNameAtom: PrimitiveAtom<PageName> = atom<PageName>("init");
3030

3131
const InitPage = ({ isCompact }: { isCompact: boolean }) => {
32-
const settings = useAtomValue(atoms.settingsAtom);
32+
const telemetrySetting = useSettingsKeyAtom("telemetry:enabled");
3333
const clientData = useAtomValue(ClientModel.getInstance().clientAtom);
34-
const [telemetryEnabled, setTelemetryEnabled] = useState<boolean>(!!settings["telemetry:enabled"]);
34+
const [telemetryEnabled, setTelemetryEnabled] = useState<boolean>(!!telemetrySetting);
3535
const setPageName = useSetAtom(pageNameAtom);
3636

3737
const acceptTos = () => {
38-
if (!clientData.tosagreed) {
38+
if (!clientData?.tosagreed) {
3939
fireAndForget(services.ClientService.AgreeTos);
4040
}
4141
if (telemetryEnabled) {
@@ -310,4 +310,4 @@ const NewInstallOnboardingModal = () => {
310310

311311
NewInstallOnboardingModal.displayName = "NewInstallOnboardingModal";
312312

313-
export { NewInstallOnboardingModal };
313+
export { InitPage, NewInstallOnboardingModal, NoTelemetryStarPage };

frontend/preview/preview.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
import Logo from "@/app/asset/logo.svg";
5+
import { ClientModel } from "@/app/store/client-model";
56
import { setWaveWindowType } from "@/app/store/windowtype";
67
import { loadFonts } from "@/util/fontutil";
78
import React, { lazy, Suspense } from "react";
@@ -119,6 +120,8 @@ function PreviewApp() {
119120

120121
function initPreview() {
121122
setWaveWindowType("preview");
123+
// Preview mode has no connected backend client object, but onboarding previews read clientAtom.
124+
ClientModel.getInstance().initialize(null);
122125
loadFonts();
123126
const root = createRoot(document.getElementById("main")!);
124127
root.render(<PreviewApp />);

frontend/preview/previews/onboarding.preview.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
import Logo from "@/app/asset/logo.svg";
5+
import { InitPage, NoTelemetryStarPage } from "@/app/onboarding/onboarding";
56
import { DurableSessionPage } from "@/app/onboarding/onboarding-durable";
67
import { FilesPage, MagnifyBlocksPage, WaveAIPage } from "@/app/onboarding/onboarding-features";
78
import { UpgradeOnboardingVersions } from "@/app/onboarding/onboarding-upgrade-patch";
@@ -10,6 +11,12 @@ function OnboardingFeaturesV() {
1011
const noop = () => {};
1112
return (
1213
<div className="flex flex-col w-full gap-8">
14+
<div className="w-[560px] rounded-[10px] p-[30px] relative overflow-hidden bg-panel">
15+
<InitPage isCompact={false} />
16+
</div>
17+
<div className="w-[560px] rounded-[10px] p-[30px] relative overflow-hidden bg-panel">
18+
<NoTelemetryStarPage isCompact={false} />
19+
</div>
1320
<div className="w-[800px] rounded-[10px] p-[30px] relative overflow-hidden bg-panel">
1421
<WaveAIPage onNext={noop} onSkip={noop} />
1522
</div>

0 commit comments

Comments
 (0)