From 2d5966e74285892d6cbaf1bbb4ae7e2ff2c7aa26 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 13 May 2022 11:26:11 +0100 Subject: [PATCH] Don't create layouts for new apps --- .../server/src/api/controllers/application.ts | 18 ------------------ packages/server/src/api/controllers/layout.js | 5 +---- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/packages/server/src/api/controllers/application.ts b/packages/server/src/api/controllers/application.ts index a1a0c6df7a..61ba794e44 100644 --- a/packages/server/src/api/controllers/application.ts +++ b/packages/server/src/api/controllers/application.ts @@ -292,12 +292,6 @@ const performAppCreate = async (ctx: any) => { const response = await db.put(newApplication, { force: true }) newApplication._rev = response.rev - // Only create the default home screens and layout if we aren't importing - // an app - if (useTemplate !== "true") { - await createEmptyAppPackage(ctx, newApplication) - } - /* istanbul ignore next */ if (!env.isTest()) { await createApp(appId) @@ -524,15 +518,3 @@ const updateAppPackage = async (appPackage: any, appId: any) => { await appCache.invalidateAppMetadata(appId) return response } - -const createEmptyAppPackage = async (ctx: any, app: any) => { - const db = getAppDB() - - let screensAndLayouts = [] - for (let layout of BASE_LAYOUTS) { - const cloned = cloneDeep(layout) - screensAndLayouts.push(await processObject(cloned, app)) - } - - await db.bulkDocs(screensAndLayouts) -} diff --git a/packages/server/src/api/controllers/layout.js b/packages/server/src/api/controllers/layout.js index 826922a047..98130dbec5 100644 --- a/packages/server/src/api/controllers/layout.js +++ b/packages/server/src/api/controllers/layout.js @@ -1,7 +1,4 @@ -const { - EMPTY_LAYOUT, - BASE_LAYOUT_PROP_IDS, -} = require("../../constants/layouts") +const { EMPTY_LAYOUT } = require("../../constants/layouts") const { generateLayoutID, getScreenParams } = require("../../db/utils") const { getAppDB } = require("@budibase/backend-core/context")