diff --git a/.codex-tasks/template-audit-execution/raw/completion-evidence.json b/.codex-tasks/template-audit-execution/raw/completion-evidence.json index d035a3b..d69a055 100644 --- a/.codex-tasks/template-audit-execution/raw/completion-evidence.json +++ b/.codex-tasks/template-audit-execution/raw/completion-evidence.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "scope": "模板完成证据登记,保留命令、日志与产物哈希", - "generatedAt": "2026-10-23T04:57:19.065Z", + "generatedAt": "2026-10-23T06:26:00.678Z", "templates": { "acheng-campus-food": { "real-manifest-interaction": { @@ -256,5 +256,5 @@ } } }, - "sourceTreeHash": "59a9701ea852e1b9240b22b85b67ef37b5bd4830f69436a94bf83066806af59d" + "sourceTreeHash": "e9ba4ece3d4b8d81e7afb2f0b62fb9c02468cf9a7da08ef80486c707f2667242" } diff --git a/apps/admin/src/features/brand/InquiryPreviewEditor.tsx b/apps/admin/src/features/brand/InquiryPreviewEditor.tsx index 2fccacf..beb25f8 100644 --- a/apps/admin/src/features/brand/InquiryPreviewEditor.tsx +++ b/apps/admin/src/features/brand/InquiryPreviewEditor.tsx @@ -28,8 +28,9 @@ export function InquiryPreviewEditor({ const record = query.data?.find((item) => item.id === runtime.key); const field = runtime.fields.find((item) => item.key === fieldKey); useEffect(() => { - if (field) form.setFieldsValue({ ...field }); - }, [fieldKey, runtime.key, form]); + if (!record || !field) return; + form.setFieldsValue({ ...field }); + }, [field, fieldKey, form, record, runtime.key]); const update = (values: Record) => runtime.fields.map((item) => (item.key === fieldKey ? { ...item, ...values } : item)); const save = useMutation({ diff --git a/apps/admin/src/features/brand/PresentationEditorInspector.tsx b/apps/admin/src/features/brand/PresentationEditorInspector.tsx index def7b6a..dbd7fea 100644 --- a/apps/admin/src/features/brand/PresentationEditorInspector.tsx +++ b/apps/admin/src/features/brand/PresentationEditorInspector.tsx @@ -173,6 +173,7 @@ export function PresentationEditorInspector({ ) : ( {!ready && !error ? (
- +
) : null} {error ? ( diff --git a/apps/admin/src/features/brand/presentation-editor-controller.ts b/apps/admin/src/features/brand/presentation-editor-controller.ts index 69c63fc..2bb77c4 100644 --- a/apps/admin/src/features/brand/presentation-editor-controller.ts +++ b/apps/admin/src/features/brand/presentation-editor-controller.ts @@ -348,14 +348,13 @@ export function usePresentationEditorController({ (page: string) => { guardDraft(() => { setBrandDirty(false); - form.setFieldsValue(initialValues); resetPreview(); setRecordDraft(undefined); setInquiryDraft(undefined); setActivePage(page); }); }, - [guardDraft, form, initialValues, resetPreview], + [guardDraft, resetPreview], ); const selectDetailOffering = useCallback((id: string) => { setDetailOfferingId(id); diff --git a/apps/admin/src/features/brand/presentation-editor-state.ts b/apps/admin/src/features/brand/presentation-editor-state.ts index 89deaac..dff5c95 100644 --- a/apps/admin/src/features/brand/presentation-editor-state.ts +++ b/apps/admin/src/features/brand/presentation-editor-state.ts @@ -89,7 +89,6 @@ export function useBrandPresentationForm({ return values; }, [brand, config, sections]); - useEffect(() => form.setFieldsValue(initialValues), [form, initialValues]); return { form, initialValues }; } diff --git a/apps/admin/src/features/brand/taro-web-components.jsx b/apps/admin/src/features/brand/taro-web-components.jsx index a667d91..f77ef8e 100644 --- a/apps/admin/src/features/brand/taro-web-components.jsx +++ b/apps/admin/src/features/brand/taro-web-components.jsx @@ -27,7 +27,21 @@ const element = (tag) => export const View = element("div"); export const Text = element("span"); -export const Button = element("button"); +export const Button = React.forwardRef( + ({ children, className, style, onClick, loading, ...props }, ref) => + React.createElement( + "button", + { + ...props, + ref, + className, + style, + onClick, + ...(loading ? { "aria-busy": "true" } : {}), + }, + children, + ), +); export const Input = React.forwardRef(({ onInput, ...props }, ref) => React.createElement("input", { ...props, diff --git a/apps/taro/test/browser/admin-editor.spec.ts b/apps/taro/test/browser/admin-editor.spec.ts index 08ce29d..130d8dd 100644 --- a/apps/taro/test/browser/admin-editor.spec.ts +++ b/apps/taro/test/browser/admin-editor.spec.ts @@ -88,6 +88,25 @@ async function verifyCanvasTargets(page: Page, manifest: any, pageKey: string) { } const adminOrigin = process.env.ADMIN_URL || "http://localhost:3005"; +const consoleWarnings = new WeakMap(); + +test.beforeEach(({ page }) => { + const warnings: string[] = []; + consoleWarnings.set(page, warnings); + page.on("console", (message) => { + const text = message.text(); + const isWarning = + message.type() === "warning" || + (message.type() === "error" && + (text.startsWith("Warning:") || text.includes("non-boolean attribute"))); + if (isWarning) warnings.push(text); + }); +}); + +test.afterEach(({ page }) => { + expect(consoleWarnings.get(page) ?? []).toEqual([]); +}); + const brand = { id: "brand-fixture", slug: "preview-fixture",