Skip to content

Commit f3d223a

Browse files
committed
fix: add migration for legacy custom layout to update sidebarAndHeader property
1 parent b0e4c0c commit f3d223a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

adminforth/modules/codeInjector.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,12 @@ class CodeInjector implements ICodeInjector {
248248
}
249249
}));
250250
}
251-
251+
async migrateLegacyCustomLayout(oldMeta) {
252+
if (oldMeta.customLayout === true) {
253+
oldMeta.sidebarAndHeader = "none";
254+
}
255+
return oldMeta;
256+
}
252257
async prepareSources() {
253258
// collects all files and folders into SPA_TMP_DIR
254259

@@ -315,14 +320,15 @@ class CodeInjector implements ICodeInjector {
315320
};
316321
const registerCustomPages = (config) => {
317322
if (config.customization.customPages) {
318-
config.customization.customPages.forEach((page) => {
323+
config.customization.customPages.forEach(async (page) => {
324+
const newMeta = await this.migrateLegacyCustomLayout(page?.component?.meta || {});
319325
routes += `{
320326
path: '${page.path}',
321327
name: '${page.path}',
322328
component: () => import('${page?.component?.file || page.component}'),
323329
meta: ${
324330
JSON.stringify({
325-
...(page?.component?.meta || {}),
331+
...newMeta,
326332
title: page.meta?.title || page.path.replace('/', '')
327333
})
328334
}

0 commit comments

Comments
 (0)