Skip to content

Commit c1d16e2

Browse files
zeekayclaude
andcommitted
builder: honor the Build/Plan choice from the landing composer
The landing/dashboard composer wrote localStorage.initialMode ('build'|'plan') but the builder's AskAI never read it — it always resumed the last composer-mode, so choosing 'Plan' on the landing was silently dropped. AskAI now seeds its mode from initialMode once on mount then clears it (mirrors the initialPrompt handoff). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 2308e54 commit c1d16e2

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

components/editor/ask-ai/index.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,20 @@ export function AskAI({
139139
const [mode, setMode] = useLocalStorage<"build" | "plan">("composer-mode", "build");
140140
const isPlan = mode === "plan";
141141

142+
// Honor the Build/Plan choice handed off from the landing / dashboard composer
143+
// (localStorage.initialMode). Applied ONCE on mount then cleared, so it seeds the
144+
// builder without overriding later manual toggles — mirrors the initialPrompt
145+
// handoff. Before this, choosing "Plan" on the landing was silently dropped.
146+
useEffect(() => {
147+
if (typeof window === "undefined") return;
148+
const handoff = localStorage.getItem("initialMode");
149+
if (handoff === "build" || handoff === "plan") {
150+
setMode(handoff);
151+
localStorage.removeItem("initialMode");
152+
}
153+
// eslint-disable-next-line react-hooks/exhaustive-deps
154+
}, []);
155+
142156
// Suggestion chips: dismissible per project (persisted). Clicking a chip sends
143157
// it straight as a message (respecting the mode), without touching the box.
144158
const [suggestionsDismissed, setSuggestionsDismissed] = useLocalStorage<boolean>(

0 commit comments

Comments
 (0)