Create flow centralization and cleanup

This commit is contained in:
adilallo
2026-04-30 08:11:55 -06:00
parent a37a72c71d
commit b7446873cd
26 changed files with 709 additions and 361 deletions
+9 -12
View File
@@ -1,22 +1,19 @@
import type { CreateFlowState } from "../../app/(app)/create/types";
import { STRIP_CUSTOM_RULE_SELECTION_STATE_KEYS } from "./customRuleFacets";
/**
* Same field removal as {@link resetCustomRuleSelections} in CreateFlowProvider.
* Used to apply template "Use without changes" in one atomic replaceState updater.
*
* Keys come from {@link CUSTOM_RULE_FACETS} / {@link STRIP_CUSTOM_RULE_SELECTION_STATE_KEYS}
* (Linear CR-92).
*/
export function stripCustomRuleSelectionFields(
prev: CreateFlowState,
): CreateFlowState {
const {
selectedCoreValueIds: _a,
coreValuesChipsSnapshot: _b,
coreValueDetailsByChipId: _c,
selectedCommunicationMethodIds: _d,
selectedMembershipMethodIds: _e,
selectedDecisionApproachIds: _f,
selectedConflictManagementIds: _g,
methodSectionsPinCommitted: _h,
...rest
} = prev;
return rest;
const out: CreateFlowState = { ...prev };
for (const key of STRIP_CUSTOM_RULE_SELECTION_STATE_KEYS) {
delete (out as Record<string, unknown>)[key as string];
}
return out;
}