mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: invalidation issue causing null organization on project's first creation.
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
|
||||
await Promise.all([
|
||||
invalidate(Dependencies.UPGRADE_PLAN),
|
||||
invalidate(Dependencies.CREATE_ORGANIZATION)
|
||||
invalidate(Dependencies.ORGANIZATION)
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,8 @@
|
||||
|
||||
async function createProjectsBottomSheet(organization: Organization): Promise<SheetMenu> {
|
||||
isLoadingProjects = true;
|
||||
loadedProjects = await projects;
|
||||
// null on non-org/project path like `onboarding`.
|
||||
loadedProjects = (await projects) ?? loadedProjects;
|
||||
isLoadingProjects = false;
|
||||
|
||||
const createProjectItem = {
|
||||
|
||||
@@ -316,15 +316,19 @@
|
||||
|
||||
$: checkForUsageLimits($organization);
|
||||
|
||||
$: projects = sdk.forConsole.projects.list([
|
||||
Query.equal(
|
||||
'teamId',
|
||||
// id from page params ?? id from store ?? id from preferences
|
||||
page.params.organization ?? currentOrganizationId ?? data.currentOrgId
|
||||
),
|
||||
Query.limit(5),
|
||||
Query.orderDesc('$updatedAt')
|
||||
]);
|
||||
$: isOnOnboarding = page.route?.id?.includes('/(console)/onboarding');
|
||||
|
||||
$: projects = isOnOnboarding
|
||||
? null
|
||||
: sdk.forConsole.projects.list([
|
||||
Query.equal(
|
||||
'teamId',
|
||||
// id from page params ?? id from store ?? id from preferences
|
||||
page.params.organization ?? currentOrganizationId ?? data.currentOrgId
|
||||
),
|
||||
Query.limit(5),
|
||||
Query.orderDesc('$updatedAt')
|
||||
]);
|
||||
|
||||
$: if ($requestedMigration) {
|
||||
openMigrationWizard();
|
||||
|
||||
@@ -5,8 +5,9 @@ import type { Coupon } from '$lib/sdk/billing';
|
||||
import type { Organization } from '$lib/stores/organization';
|
||||
|
||||
export const load: PageLoad = async ({ url, parent, depends }) => {
|
||||
depends(Dependencies.CREATE_ORGANIZATION);
|
||||
const { organizations } = await parent();
|
||||
depends(Dependencies.CREATE_ORGANIZATION);
|
||||
|
||||
const [coupon, paymentMethods] = await Promise.all([
|
||||
getCoupon(url),
|
||||
sdk.forConsole.billing.listPaymentMethods()
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
import { isCloud } from '$lib/system';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { ID } from '@appwrite.io/console';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { BillingPlan, Dependencies } from '$lib/constants';
|
||||
import { tierToPlan } from '$lib/stores/billing';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { loadAvailableRegions } from '$routes/(console)/regions';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { Button, Card, Layout, Input, Typography, Spinner } from '@appwrite.io/pink-svelte';
|
||||
import { Form } from '$lib/elements/forms/index.js';
|
||||
import { goto } from '$app/navigation';
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
|
||||
let isLoading = false;
|
||||
@@ -47,6 +47,10 @@
|
||||
if (organization) {
|
||||
loadAvailableRegions(organization?.$id).then();
|
||||
await goto(`${base}/organization-${organization.$id}`);
|
||||
|
||||
// fixes an edge case where
|
||||
// the org is not available for some reason!
|
||||
await invalidate(Dependencies.CREATE_ORGANIZATION);
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ export const ssr = false;
|
||||
|
||||
export const load: LayoutLoad = async ({ depends, url, route }) => {
|
||||
depends(Dependencies.ACCOUNT);
|
||||
depends(Dependencies.CREATE_ORGANIZATION);
|
||||
|
||||
const [account, error] = (await sdk.forConsole.account
|
||||
.get()
|
||||
|
||||
Reference in New Issue
Block a user