fix:another build error
This commit is contained in:
parent
6315c9a1ba
commit
6c90a00677
1 changed files with 6 additions and 4 deletions
|
|
@ -558,7 +558,8 @@ export function useOrgUsers() {
|
||||||
// Ensure attributes are loaded - can be called by EditActionButton
|
// Ensure attributes are loaded - can be called by EditActionButton
|
||||||
const ensureAttributesLoaded = useCallback(async () => {
|
const ensureAttributesLoaded = useCallback(async () => {
|
||||||
// Don't fetch attributes if user is not authenticated (prevents 401 errors)
|
// Don't fetch attributes if user is not authenticated (prevents 401 errors)
|
||||||
if (!user) {
|
const currentUser = getUserDataCache();
|
||||||
|
if (!currentUser) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -568,15 +569,16 @@ export function useOrgUsers() {
|
||||||
|
|
||||||
const fetchedAttributes = await fetchAttributes();
|
const fetchedAttributes = await fetchAttributes();
|
||||||
return fetchedAttributes;
|
return fetchedAttributes;
|
||||||
}, [attributes, fetchAttributes, user]);
|
}, [attributes, fetchAttributes]);
|
||||||
|
|
||||||
// Fetch attributes and permissions on mount (only if user is authenticated)
|
// Fetch attributes and permissions on mount (only if user is authenticated)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (user) {
|
const currentUser = getUserDataCache();
|
||||||
|
if (currentUser) {
|
||||||
fetchAttributes();
|
fetchAttributes();
|
||||||
fetchPermissions();
|
fetchPermissions();
|
||||||
}
|
}
|
||||||
}, [fetchAttributes, fetchPermissions, user]);
|
}, [fetchAttributes, fetchPermissions]);
|
||||||
|
|
||||||
// Initial fetch
|
// Initial fetch
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue