Compare commits

..

No commits in common. "master" and "agent/t_a9880d38-exam-corpus-reset-copy" have entirely different histories.

View File

@ -211,9 +211,7 @@ const ExamTemplateSetupInner: React.FC = () => {
setTemplate(detail) setTemplate(detail)
const editor = editorRef.current const editor = editorRef.current
if (editor) { if (editor) {
const shapes = shapesFromTemplate(detail, pageGeometriesRef.current) loadShapes(editor, shapesFromTemplate(detail, pageGeometriesRef.current))
loadShapes(editor, shapes)
if (!shapes.length) seedGuide(editor)
bringDomainShapesToFront(editor) bringDomainShapesToFront(editor)
} }
setDirty(false) setDirty(false)
@ -419,14 +417,7 @@ const ExamTemplateSetupInner: React.FC = () => {
editor.store.listen(() => setDirty(true), { scope: 'document' }) editor.store.listen(() => setDirty(true), { scope: 'document' })
applyDocViewConstraints(editor, []) applyDocViewConstraints(editor, [])
editor.resetZoom() editor.resetZoom()
// Only seed the example guide for a genuinely-empty template AFTER it has loaded. if (template) loadShapes(editor, shapesFromTemplate(template, pageGeometriesRef.current)); else seedGuide(editor)
// (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) bringDomainShapesToFront(editor)
}} }}
/> />