From c7f88e5515e65e4b2790e76eb71acbee7b9713a5 Mon Sep 17 00:00:00 2001
From: adilallo <39313955+adilallo@users.noreply.github.com>
Date: Mon, 9 Nov 2026 17:42:04 -0700
Subject: [PATCH] Keep a reopened template draft off the setup questions.
---
app/(app)/create/CreateFlowLayoutClient.tsx | 19 +++++++++++++---
app/(app)/create/utils/flowSteps.ts | 14 ++++++++++++
tests/unit/flowSteps.test.ts | 25 +++++++++++++++++++++
3 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/app/(app)/create/CreateFlowLayoutClient.tsx b/app/(app)/create/CreateFlowLayoutClient.tsx
index 85496b7..89e0d01 100644
--- a/app/(app)/create/CreateFlowLayoutClient.tsx
+++ b/app/(app)/create/CreateFlowLayoutClient.tsx
@@ -25,6 +25,7 @@ import {
CREATE_FLOW_REVIEW_RETURN_QUERY_KEY,
getNextStep,
parseReviewReturnSearchParam,
+ templatePathSkippedCommunityRedirect,
shouldOfferCreateFlowSaveAndExit,
isDirectTemplateReviewEntry,
createFlowStepUsesSelectSplitScroll,
@@ -101,6 +102,7 @@ import {
EMPTY_SETUP_TRAITS,
hasTickedSetupTrait,
} from "../../../lib/create/setupTraits";
+import { templatePathFromState } from "../../../lib/create/templatePath";
import { useAuthModal } from "../../contexts/AuthModalContext";
import { useMessages, useTranslation } from "../../contexts/MessagesContext";
import { PostLoginDraftTransfer } from "./PostLoginDraftTransfer";
@@ -424,7 +426,18 @@ function CreateFlowLayoutContent({
await runAuthenticatedExit(opts);
};
+ const templatePathRedirect = templatePathSkippedCommunityRedirect(
+ currentStep,
+ templatePathFromState(state)?.mode,
+ );
+
useEffect(() => {
+ if (!templatePathRedirect) return;
+ router.replace(createFlowStepPath(templatePathRedirect));
+ }, [router, templatePathRedirect]);
+
+ useEffect(() => {
+ if (templatePathRedirect) return;
if (
sessionResolved &&
sessionUser &&
@@ -432,7 +445,7 @@ function CreateFlowLayoutContent({
) {
router.replace(CREATE_ROUTES.review);
}
- }, [sessionResolved, sessionUser, currentStep, router]);
+ }, [sessionResolved, sessionUser, currentStep, router, templatePathRedirect]);
useEffect(() => {
clearAttempted();
@@ -967,9 +980,9 @@ function CreateFlowLayoutContent({
- {children}
+ {templatePathRedirect ? null : children}
- {!isCompletedStep && (
+ {!isCompletedStep && !templatePathRedirect && (
{
expect(getPreviousStep("final-review", opts)).toBeNull();
});
+ it("templatePathSkippedCommunityRedirect resumes setup steps and leaves decks", () => {
+ expect(
+ templatePathSkippedCommunityRedirect("setup-questions", "customize"),
+ ).toBe("core-values");
+ expect(templatePathSkippedCommunityRedirect("review", "customize")).toBe(
+ "core-values",
+ );
+ expect(
+ templatePathSkippedCommunityRedirect(
+ "community-name",
+ "useWithoutChanges",
+ ),
+ ).toBe("final-review");
+ expect(
+ templatePathSkippedCommunityRedirect("core-values", "useWithoutChanges"),
+ ).toBeNull();
+ expect(
+ templatePathSkippedCommunityRedirect("final-review", "customize"),
+ ).toBeNull();
+ expect(
+ templatePathSkippedCommunityRedirect("setup-questions", undefined),
+ ).toBeNull();
+ });
+
it("templatePathMode composes with skipCommunitySave", () => {
const opts = {
skipCommunitySave: true,