@jmruthers/pace-core 0.5.46 → 0.5.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DataTable-CBZ4FWLB.js → DataTable-ZR3ZR6HZ.js} +5 -5
- package/dist/{chunk-QGIMHNFE.js → chunk-5VISREHF.js} +3 -3
- package/dist/{chunk-YOMT5BFG.js → chunk-B7SEFA3N.js} +2 -2
- package/dist/{chunk-RZZ4U2VB.js → chunk-BN5XALQT.js} +3 -3
- package/dist/{chunk-YAACZXDE.js → chunk-FT2CYYHF.js} +4 -4
- package/dist/{chunk-UK5BMO5B.js → chunk-IWJD4ZNM.js} +3 -3
- package/dist/{chunk-ZK26ZQ3P.js → chunk-LM3Y67VN.js} +3 -3
- package/dist/{chunk-YJ7MYXN4.js → chunk-OYGUYTFO.js} +2 -2
- package/dist/{chunk-VW4YRTVX.js → chunk-S6DAOMOC.js} +43 -11
- package/dist/{chunk-VW4YRTVX.js.map → chunk-S6DAOMOC.js.map} +1 -1
- package/dist/{chunk-WUCWNFHS.js → chunk-UVFDU5JT.js} +5 -5
- package/dist/{chunk-TCPMEL3C.js → chunk-VSWL652U.js} +2 -2
- package/dist/components.js +7 -7
- package/dist/hooks.js +4 -4
- package/dist/index.js +10 -10
- package/dist/providers.js +3 -3
- package/dist/rbac/index.js +5 -5
- package/dist/utils.js +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventContextType.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/EventProviderProps.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACContextType.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACProviderProps.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +3 -3
- package/package.json +1 -1
- package/src/providers/OrganisationProvider.tsx +48 -11
- /package/dist/{DataTable-CBZ4FWLB.js.map → DataTable-ZR3ZR6HZ.js.map} +0 -0
- /package/dist/{chunk-QGIMHNFE.js.map → chunk-5VISREHF.js.map} +0 -0
- /package/dist/{chunk-YOMT5BFG.js.map → chunk-B7SEFA3N.js.map} +0 -0
- /package/dist/{chunk-RZZ4U2VB.js.map → chunk-BN5XALQT.js.map} +0 -0
- /package/dist/{chunk-YAACZXDE.js.map → chunk-FT2CYYHF.js.map} +0 -0
- /package/dist/{chunk-UK5BMO5B.js.map → chunk-IWJD4ZNM.js.map} +0 -0
- /package/dist/{chunk-ZK26ZQ3P.js.map → chunk-LM3Y67VN.js.map} +0 -0
- /package/dist/{chunk-YJ7MYXN4.js.map → chunk-OYGUYTFO.js.map} +0 -0
- /package/dist/{chunk-WUCWNFHS.js.map → chunk-UVFDU5JT.js.map} +0 -0
- /package/dist/{chunk-TCPMEL3C.js.map → chunk-VSWL652U.js.map} +0 -0
|
@@ -32,11 +32,11 @@ import {
|
|
|
32
32
|
useDataTableContext,
|
|
33
33
|
usePluginRegistry,
|
|
34
34
|
useStateManager
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import "./chunk-
|
|
35
|
+
} from "./chunk-5VISREHF.js";
|
|
36
|
+
import "./chunk-IWJD4ZNM.js";
|
|
37
37
|
import "./chunk-GWSBHC4J.js";
|
|
38
38
|
import "./chunk-7BNPOCLL.js";
|
|
39
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-VSWL652U.js";
|
|
40
40
|
import {
|
|
41
41
|
DataChunkManager,
|
|
42
42
|
SearchIndex,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
throttle,
|
|
49
49
|
useDataTablePerformance
|
|
50
50
|
} from "./chunk-SS3E6QLB.js";
|
|
51
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-S6DAOMOC.js";
|
|
52
52
|
import "./chunk-YDJW5XTN.js";
|
|
53
53
|
import "./chunk-MZBUOP4P.js";
|
|
54
54
|
import "./chunk-WJARTBCT.js";
|
|
@@ -97,4 +97,4 @@ export {
|
|
|
97
97
|
usePluginRegistry,
|
|
98
98
|
useStateManager
|
|
99
99
|
};
|
|
100
|
-
//# sourceMappingURL=DataTable-
|
|
100
|
+
//# sourceMappingURL=DataTable-ZR3ZR6HZ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCan
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IWJD4ZNM.js";
|
|
4
4
|
import {
|
|
5
5
|
useDataTablePerformance
|
|
6
6
|
} from "./chunk-SS3E6QLB.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
init_Button,
|
|
15
15
|
init_UnifiedAuthProvider,
|
|
16
16
|
useUnifiedAuth
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-S6DAOMOC.js";
|
|
18
18
|
import {
|
|
19
19
|
getCurrentAppName,
|
|
20
20
|
init_appNameResolver
|
|
@@ -5584,4 +5584,4 @@ export {
|
|
|
5584
5584
|
GroupHeader,
|
|
5585
5585
|
EditableRow
|
|
5586
5586
|
};
|
|
5587
|
-
//# sourceMappingURL=chunk-
|
|
5587
|
+
//# sourceMappingURL=chunk-5VISREHF.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
init_UnifiedAuthProvider,
|
|
4
4
|
useOrganisations,
|
|
5
5
|
useUnifiedAuth
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S6DAOMOC.js";
|
|
7
7
|
import {
|
|
8
8
|
init_organisationContext,
|
|
9
9
|
setOrganisationContext
|
|
@@ -379,4 +379,4 @@ function useSecureDataAccess() {
|
|
|
379
379
|
export {
|
|
380
380
|
useSecureDataAccess
|
|
381
381
|
};
|
|
382
|
-
//# sourceMappingURL=chunk-
|
|
382
|
+
//# sourceMappingURL=chunk-B7SEFA3N.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_EventProvider
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VSWL652U.js";
|
|
4
4
|
import {
|
|
5
5
|
init_AuthProvider,
|
|
6
6
|
init_InactivityProvider,
|
|
7
7
|
init_OrganisationProvider,
|
|
8
8
|
init_UnifiedAuthProvider
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-S6DAOMOC.js";
|
|
10
10
|
|
|
11
11
|
// src/providers/index.ts
|
|
12
12
|
init_EventProvider();
|
|
@@ -14,4 +14,4 @@ init_OrganisationProvider();
|
|
|
14
14
|
init_UnifiedAuthProvider();
|
|
15
15
|
init_AuthProvider();
|
|
16
16
|
init_InactivityProvider();
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-BN5XALQT.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
useAccessLevel,
|
|
6
6
|
useCan
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IWJD4ZNM.js";
|
|
8
8
|
import {
|
|
9
9
|
OrganisationContextRequiredError,
|
|
10
10
|
RBACCache,
|
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
} from "./chunk-GWSBHC4J.js";
|
|
14
14
|
import {
|
|
15
15
|
useSecureDataAccess
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-B7SEFA3N.js";
|
|
17
17
|
import {
|
|
18
18
|
init_RBACProvider,
|
|
19
19
|
init_UnifiedAuthProvider,
|
|
20
20
|
useUnifiedAuth
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-S6DAOMOC.js";
|
|
22
22
|
import {
|
|
23
23
|
getCurrentAppName,
|
|
24
24
|
init_appNameResolver
|
|
@@ -1929,4 +1929,4 @@ export {
|
|
|
1929
1929
|
getPermissionsForRole,
|
|
1930
1930
|
ALL_PERMISSIONS
|
|
1931
1931
|
};
|
|
1932
|
-
//# sourceMappingURL=chunk-
|
|
1932
|
+
//# sourceMappingURL=chunk-FT2CYYHF.js.map
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
init_EventProvider,
|
|
9
9
|
useEvents
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VSWL652U.js";
|
|
11
11
|
import {
|
|
12
12
|
init_OrganisationProvider,
|
|
13
13
|
init_UnifiedAuthProvider,
|
|
14
14
|
useOrganisations,
|
|
15
15
|
useUnifiedAuth
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-S6DAOMOC.js";
|
|
17
17
|
|
|
18
18
|
// src/rbac/hooks/useRBAC.ts
|
|
19
19
|
init_UnifiedAuthProvider();
|
|
@@ -506,4 +506,4 @@ export {
|
|
|
506
506
|
useHasAllPermissions,
|
|
507
507
|
useCachedPermissions
|
|
508
508
|
};
|
|
509
|
-
//# sourceMappingURL=chunk-
|
|
509
|
+
//# sourceMappingURL=chunk-IWJD4ZNM.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
usePublicPageContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OYGUYTFO.js";
|
|
4
4
|
import {
|
|
5
5
|
init_OrganisationProvider,
|
|
6
6
|
init_UnifiedAuthProvider,
|
|
7
7
|
useOrganisations,
|
|
8
8
|
useUnifiedAuth
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-S6DAOMOC.js";
|
|
10
10
|
|
|
11
11
|
// src/hooks/useOrganisationPermissions.ts
|
|
12
12
|
init_OrganisationProvider();
|
|
@@ -519,4 +519,4 @@ export {
|
|
|
519
519
|
generatePublicRoutePath,
|
|
520
520
|
extractEventCodeFromPath
|
|
521
521
|
};
|
|
522
|
-
//# sourceMappingURL=chunk-
|
|
522
|
+
//# sourceMappingURL=chunk-LM3Y67VN.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_UnifiedAuthProvider,
|
|
3
3
|
useUnifiedAuth
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-S6DAOMOC.js";
|
|
5
5
|
|
|
6
6
|
// src/components/PublicLayout/PublicErrorBoundary.tsx
|
|
7
7
|
import React, { Component } from "react";
|
|
@@ -386,4 +386,4 @@ export {
|
|
|
386
386
|
clearPublicLogoCache,
|
|
387
387
|
getPublicLogoCacheStats
|
|
388
388
|
};
|
|
389
|
-
//# sourceMappingURL=chunk-
|
|
389
|
+
//# sourceMappingURL=chunk-OYGUYTFO.js.map
|
|
@@ -7289,7 +7289,7 @@ __export(OrganisationProvider_exports, {
|
|
|
7289
7289
|
OrganisationProvider: () => OrganisationProvider,
|
|
7290
7290
|
useOrganisations: () => useOrganisations
|
|
7291
7291
|
});
|
|
7292
|
-
import { createContext as createContext5, useContext as useContext5, useState as useState7, useEffect as useEffect7, useCallback as useCallback7, useMemo as useMemo6 } from "react";
|
|
7292
|
+
import { createContext as createContext5, useContext as useContext5, useState as useState7, useEffect as useEffect7, useCallback as useCallback7, useMemo as useMemo6, useRef as useRef2 } from "react";
|
|
7293
7293
|
import { useNavigate } from "react-router-dom";
|
|
7294
7294
|
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
7295
7295
|
function OrganisationProvider({ children }) {
|
|
@@ -7301,6 +7301,9 @@ function OrganisationProvider({ children }) {
|
|
|
7301
7301
|
const [error, setError] = useState7(null);
|
|
7302
7302
|
const [isContextReady, setIsContextReady] = useState7(false);
|
|
7303
7303
|
const [retryCount, setRetryCount] = useState7(0);
|
|
7304
|
+
const isLoadingRef = useRef2(false);
|
|
7305
|
+
const lastLoadTimeRef = useRef2(0);
|
|
7306
|
+
const hasFailedRef = useRef2(false);
|
|
7304
7307
|
const { user, session, supabase, signOut } = useUnifiedAuth();
|
|
7305
7308
|
let navigate = null;
|
|
7306
7309
|
try {
|
|
@@ -7354,10 +7357,17 @@ function OrganisationProvider({ children }) {
|
|
|
7354
7357
|
setError(null);
|
|
7355
7358
|
return;
|
|
7356
7359
|
}
|
|
7357
|
-
if (
|
|
7358
|
-
|
|
7360
|
+
if (isLoadingRef.current) {
|
|
7361
|
+
console.log("OrganisationProvider", "Already loading, skipping duplicate load");
|
|
7359
7362
|
return;
|
|
7360
7363
|
}
|
|
7364
|
+
const now = Date.now();
|
|
7365
|
+
if (now - lastLoadTimeRef.current < 2e3) {
|
|
7366
|
+
console.log("OrganisationProvider", "Too soon since last load, skipping");
|
|
7367
|
+
return;
|
|
7368
|
+
}
|
|
7369
|
+
lastLoadTimeRef.current = now;
|
|
7370
|
+
isLoadingRef.current = true;
|
|
7361
7371
|
setIsLoading(true);
|
|
7362
7372
|
setError(null);
|
|
7363
7373
|
try {
|
|
@@ -7391,7 +7401,14 @@ function OrganisationProvider({ children }) {
|
|
|
7391
7401
|
if (!memberships || memberships.length === 0) {
|
|
7392
7402
|
throw new Error("User has no active organisation memberships");
|
|
7393
7403
|
}
|
|
7404
|
+
console.log("[OrganisationProvider] All memberships data:", memberships);
|
|
7394
7405
|
memberships.forEach((membership, index) => {
|
|
7406
|
+
console.log(`[OrganisationProvider] Membership ${index}:`, {
|
|
7407
|
+
organisation_id: membership.organisation_id,
|
|
7408
|
+
type: typeof membership.organisation_id,
|
|
7409
|
+
length: membership.organisation_id ? membership.organisation_id.length : "null/undefined",
|
|
7410
|
+
trimmed: membership.organisation_id ? membership.organisation_id.trim() : "null/undefined"
|
|
7411
|
+
});
|
|
7395
7412
|
if (!membership.organisation_id || membership.organisation_id.trim() === "") {
|
|
7396
7413
|
console.warn(`[OrganisationProvider] Membership ${index} has invalid organisation_id:`, membership);
|
|
7397
7414
|
}
|
|
@@ -7417,7 +7434,17 @@ function OrganisationProvider({ children }) {
|
|
|
7417
7434
|
throw new Error("No valid organisation IDs found in memberships");
|
|
7418
7435
|
}
|
|
7419
7436
|
DebugLogger.log("OrganisationProvider", "Valid organisation IDs:", organisationIds);
|
|
7420
|
-
|
|
7437
|
+
console.log("[OrganisationProvider] Raw organisation IDs before cleaning:", organisationIds);
|
|
7438
|
+
console.log("[OrganisationProvider] Raw organisation IDs types:", organisationIds.map((id) => typeof id));
|
|
7439
|
+
console.log("[OrganisationProvider] Raw organisation IDs lengths:", organisationIds.map((id) => id ? id.length : "null/undefined"));
|
|
7440
|
+
const cleanOrganisationIds = organisationIds.filter((id) => {
|
|
7441
|
+
const isValid = id && typeof id === "string" && id.trim() !== "";
|
|
7442
|
+
if (!isValid) {
|
|
7443
|
+
console.warn("[OrganisationProvider] Filtering out invalid ID:", { id, type: typeof id, length: id ? id.length : "null/undefined" });
|
|
7444
|
+
}
|
|
7445
|
+
return isValid;
|
|
7446
|
+
});
|
|
7447
|
+
console.log("[OrganisationProvider] Clean organisation IDs after filtering:", cleanOrganisationIds);
|
|
7421
7448
|
if (cleanOrganisationIds.length === 0) {
|
|
7422
7449
|
console.warn("[OrganisationProvider] No clean organisation IDs after filtering:", organisationIds);
|
|
7423
7450
|
throw new Error("No valid organisation IDs found after cleaning");
|
|
@@ -7489,27 +7516,30 @@ function OrganisationProvider({ children }) {
|
|
|
7489
7516
|
userRole: roleMap.get(initialOrg.id)
|
|
7490
7517
|
});
|
|
7491
7518
|
setRetryCount(0);
|
|
7519
|
+
hasFailedRef.current = false;
|
|
7492
7520
|
} catch (err) {
|
|
7493
7521
|
console.error("[OrganisationProvider] Failed to load organisations:", err);
|
|
7494
7522
|
setError(err);
|
|
7495
7523
|
setRetryCount((prev) => prev + 1);
|
|
7524
|
+
hasFailedRef.current = true;
|
|
7496
7525
|
clearAllCachedData();
|
|
7497
7526
|
} finally {
|
|
7527
|
+
isLoadingRef.current = false;
|
|
7498
7528
|
setIsLoading(false);
|
|
7499
7529
|
}
|
|
7500
7530
|
}, [user, session, supabase, clearAllCachedData]);
|
|
7501
7531
|
useEffect7(() => {
|
|
7502
|
-
if (user && session && supabase && !isLoading) {
|
|
7503
|
-
if (retryCount >= 3) {
|
|
7504
|
-
console.error("[OrganisationProvider] Max retry count reached, stopping organisation loading");
|
|
7532
|
+
if (user && session && supabase && !isLoading && !isLoadingRef.current) {
|
|
7533
|
+
if (retryCount >= 3 || hasFailedRef.current) {
|
|
7534
|
+
console.error("[OrganisationProvider] Max retry count reached or failed flag set, stopping organisation loading");
|
|
7505
7535
|
setError(new Error("Failed to load organisations after multiple attempts"));
|
|
7506
7536
|
setIsLoading(false);
|
|
7507
7537
|
return;
|
|
7508
7538
|
}
|
|
7509
|
-
|
|
7539
|
+
console.log("[OrganisationProvider] Authentication stable, loading organizations... (retry:", retryCount, ")");
|
|
7510
7540
|
loadUserOrganisations();
|
|
7511
7541
|
} else if (!user && !session) {
|
|
7512
|
-
|
|
7542
|
+
console.log("[OrganisationProvider] No authentication, clearing organization state");
|
|
7513
7543
|
setSelectedOrganisation(null);
|
|
7514
7544
|
setOrganisations([]);
|
|
7515
7545
|
setUserMemberships([]);
|
|
@@ -7517,10 +7547,12 @@ function OrganisationProvider({ children }) {
|
|
|
7517
7547
|
setIsLoading(false);
|
|
7518
7548
|
setError(null);
|
|
7519
7549
|
setRetryCount(0);
|
|
7550
|
+
isLoadingRef.current = false;
|
|
7551
|
+
hasFailedRef.current = false;
|
|
7520
7552
|
localStorage.removeItem(STORAGE_KEYS2.SELECTED_ORGANISATION);
|
|
7521
7553
|
localStorage.removeItem(STORAGE_KEYS2.ORGANISATION_CONTEXT);
|
|
7522
7554
|
}
|
|
7523
|
-
}, [user, session, supabase, isLoading,
|
|
7555
|
+
}, [user, session, supabase, isLoading, retryCount]);
|
|
7524
7556
|
const handleLogoutAndRedirect = useCallback7(async () => {
|
|
7525
7557
|
try {
|
|
7526
7558
|
await signOut();
|
|
@@ -7769,4 +7801,4 @@ lodash/lodash.js:
|
|
|
7769
7801
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
7770
7802
|
*)
|
|
7771
7803
|
*/
|
|
7772
|
-
//# sourceMappingURL=chunk-
|
|
7804
|
+
//# sourceMappingURL=chunk-S6DAOMOC.js.map
|