From ab4f5427417b972cb097aa2302aef78e090d6084 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 21 May 2026 01:38:19 +0000 Subject: [PATCH 1/2] fix(web): iOS onboarding safe-area + back-nav persistence in prechat (LUM-1763) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Back-port of vellum-ai/vellum-assistant-platform#7461. Two related iOS prechat polish fixes that landed on the platform side after the onboarding paths were frozen: 1. **Safe-area top spacing.** `NameStepScreen` and `VibeStepScreen` were using a flat `pt-4`, which on iOS slides the back-button row under the status bar / Dynamic Island. Switch to `calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 1rem)` so the standard 1rem padding sits on top of the system inset. 2. **Back-nav persistence.** `PreChatFlow` resets to screen 0 on every mount, so an iOS user who taps through to the vibe step and then hot-reloads (or returns after the OS reclaims memory) is silently dropped back to the name step. Remember the position in `sessionStorage` under `prechat_native_screen`; restore on mount; clear on back-from-vibe and on finishNativePreChat. Storage writes are wrapped in try/catch so private-mode contexts don't throw. The other PR in LUM-1763 (#7355 — alex-nork's Sanity connection for the content-automation cohort) is deferred as a cohort- specific feature, not a small drift fix. Verified locally: lint, typecheck clean. https://claude.ai/code/session_01JPGu4yGPTL4JoLaPuqpEW2 --- .../onboarding/pages/pre-chat-flow.tsx | 46 +++++++++++++++++-- .../onboarding/screens/name-step-screen.tsx | 11 ++++- .../onboarding/screens/vibe-step-screen.tsx | 10 +++- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/apps/web/src/domains/onboarding/pages/pre-chat-flow.tsx b/apps/web/src/domains/onboarding/pages/pre-chat-flow.tsx index c9d907fa490..a55d916f296 100644 --- a/apps/web/src/domains/onboarding/pages/pre-chat-flow.tsx +++ b/apps/web/src/domains/onboarding/pages/pre-chat-flow.tsx @@ -72,7 +72,19 @@ export function PreChatFlow() { (isIOSWeb && !readIOSAppDownloaded()) || (isMacOSWeb && !readMacOsAppDownloaded()); - const [screen, setScreen] = useState(0); + // Native pre-chat restores its position across reloads via sessionStorage + // — without this, an iOS user who's tapped through to the vibe step and + // hot-reloads (or returns after the OS reclaims memory) is silently + // dropped back to the name step. + const [screen, setScreen] = useState(() => { + try { + const saved = sessionStorage.getItem("prechat_native_screen"); + if (saved === "1") return 1; + } catch { + // sessionStorage can throw under privacy modes — ignore. + } + return 0; + }); const [selectedTools, setSelectedTools] = useState>( () => new Set(), ); @@ -197,8 +209,22 @@ export function PreChatFlow() { displayedAssistantNames={displayedAssistantNames} onUserNameChange={handleUserNameChange} onAssistantNameChange={setAssistantName} - onContinue={() => setScreen(1)} - onSkip={() => setScreen(1)} + onContinue={() => { + setScreen(1); + try { + sessionStorage.setItem("prechat_native_screen", "1"); + } catch { + // ignore — see initial-state comment. + } + }} + onSkip={() => { + setScreen(1); + try { + sessionStorage.setItem("prechat_native_screen", "1"); + } catch { + // ignore — see initial-state comment. + } + }} currentStep={0} totalSteps={IOS_TOTAL_STEPS} /> @@ -223,13 +249,25 @@ export function PreChatFlow() { if (trimmedAssistant) { setPendingAssistantName(trimmedAssistant); } + try { + sessionStorage.removeItem("prechat_native_screen"); + } catch { + // ignore — see initial-state comment. + } void navigate(routes.onboarding.privacy); }; return ( setScreen(0)} + onBack={() => { + setScreen(0); + try { + sessionStorage.removeItem("prechat_native_screen"); + } catch { + // ignore — see initial-state comment. + } + }} onContinue={finishNativePreChat} onSkip={finishNativePreChat} currentStep={1} diff --git a/apps/web/src/domains/onboarding/screens/name-step-screen.tsx b/apps/web/src/domains/onboarding/screens/name-step-screen.tsx index 5a22390f727..cea5bdf7862 100644 --- a/apps/web/src/domains/onboarding/screens/name-step-screen.tsx +++ b/apps/web/src/domains/onboarding/screens/name-step-screen.tsx @@ -34,8 +34,15 @@ export function NameStepScreen({
{onBack ? (