diff --git a/src/lib/stores/preferences.ts b/src/lib/stores/preferences.ts index a665bafd37..38b45513a4 100644 --- a/src/lib/stores/preferences.ts +++ b/src/lib/stores/preferences.ts @@ -110,9 +110,7 @@ function createPreferences() { return n; }), - loadTeamPrefs: async () => { - const id = get(organization)?.$id; - if (!id) return {}; + loadTeamPrefs: async (id: string) => { const teamPrefs = await sdk.forConsole.teams.getPrefs(id); update((n) => { n[id] = teamPrefs; diff --git a/src/routes/console/project-[project]/+layout.ts b/src/routes/console/project-[project]/+layout.ts index f2747454ad..ab513b5831 100644 --- a/src/routes/console/project-[project]/+layout.ts +++ b/src/routes/console/project-[project]/+layout.ts @@ -2,6 +2,7 @@ import { Dependencies } from '$lib/constants'; import { sdk } from '$lib/stores/sdk'; import { error } from '@sveltejs/kit'; import type { LayoutLoad } from './$types'; +import { preferences } from '$lib/stores/preferences'; export const load: LayoutLoad = async ({ params, depends }) => { depends(Dependencies.PROJECT); @@ -10,6 +11,7 @@ export const load: LayoutLoad = async ({ params, depends }) => { const project = await sdk.forConsole.projects.get(params.project); localStorage.setItem('project', project.$id); localStorage.setItem('organization', project.teamId); + preferences.loadTeamPrefs(project.teamId); return { project, diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/+layout.ts b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/+layout.ts index 9430144199..4f8cfc2edf 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/+layout.ts +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/+layout.ts @@ -6,10 +6,8 @@ import Header from './header.svelte'; import { error } from '@sveltejs/kit'; import SubNavigation from './subNavigation.svelte'; import { Query } from '@appwrite.io/console'; -import { preferences } from '$lib/stores/preferences'; export const load: LayoutLoad = async ({ params, depends }) => { - await preferences.loadTeamPrefs(); depends(Dependencies.COLLECTION); try { return {