From d69203ff5eaab107f7f0fcfffc8ed6b8fbd3dfc0 Mon Sep 17 00:00:00 2001 From: Vitalii Nobis Date: Thu, 18 Jan 2024 14:13:24 +0000 Subject: [PATCH] fix: unlink template fix --- packages/api-page-builder/src/graphql/crud/pages.crud.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/api-page-builder/src/graphql/crud/pages.crud.ts b/packages/api-page-builder/src/graphql/crud/pages.crud.ts index cf4cad3bfd7..83adb256a25 100644 --- a/packages/api-page-builder/src/graphql/crud/pages.crud.ts +++ b/packages/api-page-builder/src/graphql/crud/pages.crud.ts @@ -548,7 +548,11 @@ export const createPageCrud = (params: CreatePageCrudParams): PagesCrud => { // Delete template-related data. const allTemplateVariableIds = processedPage .content!.data.template.variables.map((variablesForBlock: Record) => { - return variablesForBlock.variables.map((v: Record) => v.id); + if (Array.isArray(variablesForBlock.variables)) { + return variablesForBlock.variables.map((v: Record) => v.id); + } + + return []; }) .flat();