update: realtime callback for project name.

This commit is contained in:
Darshan committed 2025-11-06 19:33:19 +05:30
1 parent ccfa7c7248
commit 22c10e40bb
5 files changed
+1239 -1107

No files matched your search

-1
View File
@@ -106,7 +106,6 @@ if (!building) {
scopedConsoleClient.setProject('console');
clientConsole.setEndpoint(endpoint).setProject('console');
clientRealtime.setEndpoint(endpoint).setProject('console');
clientProject.setEndpoint(endpoint).setMode('admin');
clientRealtime.setEndpoint(endpoint).setProject('console');
}
+14 -3
View File
@@ -7,16 +7,27 @@
import { onMount } from 'svelte';
import { ensureStudioComponent, initImagine, getWebComponents } from './studio-widget';
import { app } from '$lib/stores/app';
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
const { region, projectId }: { region: string; projectId: string } = $props();
onMount(() => {
onMount(async () => {
ensureStudioComponent();
initImagine(region, projectId);
await initImagine(region, projectId);
const { changeTheme, initImagineCallbacks } = await getWebComponents();
if (initImagineCallbacks) {
initImagineCallbacks({
onProjectNameChange: (name) => {
invalidate(Dependencies.PROJECT);
}
});
}
return app.subscribe(async ($app) => {
try {
const { changeTheme } = await getWebComponents();
if (changeTheme) {
changeTheme($app.themeInUse);
}
@@ -26,13 +26,18 @@
projectId: $project.$id,
name
});
await invalidate(Dependencies.PROJECT);
await invalidate(Dependencies.ORGANIZATION);
addNotification({
type: 'success',
message: 'Project name has been updated'
});
trackEvent(Submit.ProjectUpdateName);
await Promise.all([
await invalidate(Dependencies.PROJECT),
await invalidate(Dependencies.ORGANIZATION)
]);
} catch (error) {
addNotification({
type: 'error',