fix: catch organization list fetch error in loader (#10058)

This commit is contained in:
Kent Wang
2026-06-11 04:29:19 +08:00
committed by GitHub
parent 07a09b519d
commit 0705350a89
2 changed files with 16 additions and 8 deletions

View File

@@ -79,14 +79,18 @@ export async function clientLoader({ params }: Route.ClientLoaderArgs) {
return redirect(href('/organization/:organizationId', { organizationId }));
}
const organization = await services.organization.get(organizationId);
try {
const organization = await services.organization.get(organizationId);
if (accountId && organization && models.organization.isPersonalOrganization(organization)) {
const firstPersonalOrgLandingKey = `firstPersonalOrgLandingHandled:${accountId}`;
if (accountId && organization && models.organization.isPersonalOrganization(organization)) {
const firstPersonalOrgLandingKey = `firstPersonalOrgLandingHandled:${accountId}`;
if (!window.localStorage.getItem(firstPersonalOrgLandingKey)) {
window.localStorage.setItem(firstPersonalOrgLandingKey, 'true');
if (!window.localStorage.getItem(firstPersonalOrgLandingKey)) {
window.localStorage.setItem(firstPersonalOrgLandingKey, 'true');
}
}
} catch (error) {
console.log('[organizations] Failed to load Organizations', error);
}
const fallbackLearningFeature = {

View File

@@ -33,9 +33,13 @@ const shouldAutoCreateInitialProject = async ({
return false;
}
const organization = await services.organization.get(organizationId);
if (!organization || !models.organization.isPersonalOrganization(organization)) {
try {
const organization = await services.organization.get(organizationId);
if (!organization || !models.organization.isPersonalOrganization(organization)) {
return false;
}
} catch (error) {
console.log('[organizations] Failed to load Organizations', error);
return false;
}