Skip to content

Commit f081629

Browse files
committed
Fix 2 bugs: redirect after creating templates, updating layout editor after switching templates
1 parent 432398c commit f081629

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/routes/org.program.$programId.templates.$templateId.edit-layout.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ export default function TemplateEditorPage() {
129129
const [layout, setLayout] = useState(template.layout);
130130
const [switchEditor, setSwitchEditor] = useState("visual");
131131

132+
useEffect(() => {
133+
setLayout(template.layout);
134+
}, [template.id, template.layout]);
135+
132136
// @todo – when editing the template in JSON code,
133137
// allow for a graceful handling of JSON syntax errors instead of preventing edits
134138

app/routes/org.program.$programId.templates.create.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export const action: ActionFunction = async ({ request, params }) => {
9090
await generateTemplateSample(template);
9191
await generatePreviewOfTemplate(template);
9292
return redirect(
93-
`/org/program/${params.programId}/${template.id}/edit-layout`,
93+
`/org/program/${params.programId}/templates/${template.id}/edit-layout`,
9494
);
9595
}
9696

0 commit comments

Comments
 (0)