From 78662c8dc949ddb350cd94f8250f73a9cbdcdb23 Mon Sep 17 00:00:00 2001 From: Viren070 Date: Sun, 19 Oct 2025 17:22:12 +0100 Subject: [PATCH] fix(frontend): throw error when importing template through config import --- .../src/components/menu/save-install.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/frontend/src/components/menu/save-install.tsx b/packages/frontend/src/components/menu/save-install.tsx index f2714e14..04795790 100644 --- a/packages/frontend/src/components/menu/save-install.tsx +++ b/packages/frontend/src/components/menu/save-install.tsx @@ -214,17 +214,16 @@ function Content() { const reader = new FileReader(); reader.onload = (event) => { try { - const json = applyMigrations( - JSON.parse(event.target?.result as string) - ); - // const validate = UserDataSchema.safeParse(json); - // if (!validate.success) { - // toast.error('Failed to import configuration: Invalid JSON file'); - // return; - // } + const parsed = JSON.parse(event.target?.result as string); + if (parsed.metadata) { + toast.error( + 'The imported file is a template, please use the template import option instead.' + ); + return; + } setUserData((prev) => ({ ...prev, - ...json, + ...applyMigrations(parsed), })); toast.success('Configuration imported successfully'); } catch (err) {