update: logic as per the component updates.

This commit is contained in:
Darshan
2025-11-07 11:30:16 +05:30
parent aa71f9744a
commit ac902cd2d8
2 changed files with 13 additions and 13 deletions
+7 -2
View File
@@ -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;
+6 -11
View File
@@ -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);
}