Persist choices through to completed page
This commit is contained in:
@@ -163,16 +163,11 @@ export function useTemplateReviewActions({
|
||||
})
|
||||
: sections;
|
||||
|
||||
const summaryRaw =
|
||||
typeof template.description === "string"
|
||||
? template.description.trim()
|
||||
: "";
|
||||
const hasCommunityName =
|
||||
typeof state.title === "string" && state.title.trim().length > 0;
|
||||
updateState({
|
||||
...coreValuesPrefill,
|
||||
sections: sectionsWithoutValues,
|
||||
...(summaryRaw.length > 0 ? { summary: summaryRaw } : {}),
|
||||
templateReviewBackSlug: templateReviewSlug,
|
||||
...(hasCommunityName
|
||||
? { pendingTemplateAction: undefined }
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { CommunityRuleSection } from "../../../../components/type/Community
|
||||
import Alert from "../../../../components/modals/Alert";
|
||||
import { useMessages } from "../../../../contexts/MessagesContext";
|
||||
import { fetchPublishedRuleDetail } from "../../../../../lib/create/api";
|
||||
import { parseDocumentSectionsForDisplay } from "../../../../../lib/create/buildPublishPayload";
|
||||
import { parsePublishedDocumentForCommunityRuleDisplay } from "../../../../../lib/create/publishedDocumentToDisplaySections";
|
||||
import {
|
||||
readLastPublishedRule,
|
||||
writeLastPublishedRule,
|
||||
@@ -48,7 +48,7 @@ function initialCompletedUi(
|
||||
documentSections: [],
|
||||
};
|
||||
}
|
||||
const parsed = parseDocumentSectionsForDisplay(stored.document);
|
||||
const parsed = parsePublishedDocumentForCommunityRuleDisplay(stored.document);
|
||||
if (parsed.length === 0) {
|
||||
return {
|
||||
headerTitle: "",
|
||||
@@ -105,7 +105,7 @@ export function CompletedScreen() {
|
||||
summary: detail.rule.summary,
|
||||
document: doc,
|
||||
});
|
||||
const parsed = parseDocumentSectionsForDisplay(doc);
|
||||
const parsed = parsePublishedDocumentForCommunityRuleDisplay(doc);
|
||||
if (parsed.length === 0) {
|
||||
router.replace(`/rules/${encodeURIComponent(ruleIdParam)}`);
|
||||
return;
|
||||
|
||||
@@ -170,8 +170,7 @@ export function FinalReviewScreen() {
|
||||
|
||||
/**
|
||||
* Match {@link CommunityReviewScreen}: the card body is the free-text
|
||||
* `community-context` field only — not `summary` (template / one-line
|
||||
* rule summary can carry template-review copy).
|
||||
* `community-context` field only — not `summary`.
|
||||
*/
|
||||
const ruleCardDescription = useMemo(() => {
|
||||
const raw =
|
||||
|
||||
Reference in New Issue
Block a user