From ac902cd2d80799cbac294b8d0af86468b4f7b947 Mon Sep 17 00:00:00 2001 From: Darshan Date: Fri, 7 Nov 2025 11:30:16 +0530 Subject: [PATCH] update: logic as per the component updates. --- src/lib/studio/studio-widget.ts | 9 +++++++-- src/lib/studio/studio.svelte | 17 ++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/lib/studio/studio-widget.ts b/src/lib/studio/studio-widget.ts index 859e8376f..16359c750 100644 --- a/src/lib/studio/studio-widget.ts +++ b/src/lib/studio/studio-widget.ts @@ -270,7 +270,11 @@ export function hideStudio() { restoreBodyScroll(); } -export async function initImagine(region: string, projectId: string) { +export async function initImagine( + region: string, + projectId: string, + callbacks?: { onProjectNameChange?: (name: string) => void } +) { try { const { initImagineConfig, initImagineRouting } = await getWebComponents(); @@ -281,7 +285,8 @@ export async function initImagine(region: string, projectId: string) { APPWRITE_ENDPOINT: PUBLIC_APPWRITE_ENDPOINT }, { - initialTheme: get(app).themeInUse + initialTheme: get(app).themeInUse, + callbacks } ); configInitialized = true; diff --git a/src/lib/studio/studio.svelte b/src/lib/studio/studio.svelte index 0527ed3c3..ddc65d5c8 100644 --- a/src/lib/studio/studio.svelte +++ b/src/lib/studio/studio.svelte @@ -15,23 +15,18 @@ onMount(() => { ensureStudioComponent(); - initImagine(region, projectId); + initImagine(region, projectId, { + onProjectNameChange: () => { + invalidate(Dependencies.PROJECT); + } + }); return app.subscribe(async ($app) => { - const { changeTheme, initImagineCallbacks } = await getWebComponents(); - try { + const { changeTheme } = await getWebComponents(); if (changeTheme) { changeTheme($app.themeInUse); } - - if (initImagineCallbacks) { - initImagineCallbacks({ - onProjectNameChange: () => { - invalidate(Dependencies.PROJECT); - } - }); - } } catch (error) { console.error('Failed to change theme:', error); }