mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: initialize regions store as empty ConsoleRegionList
Using undefined as the initial value can lead to issues when trying to access the store such as: TypeError: Cannot read properties of undefined (reading 'regions')
This commit is contained in:
2 files changed
+2
-2
No files matched your search
@@ -61,4 +61,4 @@ export const organization = derived(page, ($page) => $page.data?.organization as
|
||||
export const currentPlan = derived(page, ($page) => $page.data?.currentPlan as Plan);
|
||||
export const members = derived(page, ($page) => $page.data.members as Models.MembershipList);
|
||||
|
||||
export const regions = writable<Models.ConsoleRegionList | undefined>(undefined);
|
||||
export const regions = writable<Models.ConsoleRegionList>({ total: 0, regions: [] });
|
||||
@@ -16,7 +16,7 @@ export async function loadAvailableRegions(orgId: string): Promise<void> {
|
||||
try {
|
||||
const storedRegions = get(regions);
|
||||
|
||||
if (storedRegions?.regions && lastLoadedOrganization === orgId) {
|
||||
if (storedRegions.regions && lastLoadedOrganization === orgId) {
|
||||
// already loaded for this organization, fast path return.
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user