diff --git a/src/pages/exam/setup/ExamTemplateSetupPage.tsx b/src/pages/exam/setup/ExamTemplateSetupPage.tsx index 6d35589..c57acfc 100644 --- a/src/pages/exam/setup/ExamTemplateSetupPage.tsx +++ b/src/pages/exam/setup/ExamTemplateSetupPage.tsx @@ -211,7 +211,9 @@ const ExamTemplateSetupInner: React.FC = () => { setTemplate(detail) const editor = editorRef.current if (editor) { - loadShapes(editor, shapesFromTemplate(detail, pageGeometriesRef.current)) + const shapes = shapesFromTemplate(detail, pageGeometriesRef.current) + loadShapes(editor, shapes) + if (!shapes.length) seedGuide(editor) bringDomainShapesToFront(editor) } setDirty(false) @@ -417,7 +419,14 @@ const ExamTemplateSetupInner: React.FC = () => { editor.store.listen(() => setDirty(true), { scope: 'document' }) applyDocViewConstraints(editor, []) editor.resetZoom() - if (template) loadShapes(editor, shapesFromTemplate(template, pageGeometriesRef.current)); else seedGuide(editor) + // Only seed the example guide for a genuinely-empty template AFTER it has loaded. + // (Previously `else seedGuide` fired on mount while `template` was still null during + // the async fetch, flashing placeholder shapes before the real shapes/PDF rendered.) + if (template) { + const s = shapesFromTemplate(template, pageGeometriesRef.current) + loadShapes(editor, s) + if (!s.length) seedGuide(editor) + } bringDomainShapesToFront(editor) }} />