Resolve the exhaustive-deps findings and attach cause to the rethrown errors. [skip build]
This commit is contained in:
@@ -76,7 +76,7 @@ export const useAsync = <TData, TError, TArgs extends unknown[]>(
|
||||
return data;
|
||||
} catch (e) {
|
||||
if (currentReqNumber !== reqNumberRef.current) {
|
||||
throw new Error('AsyncCallbackHook: Request replaced!');
|
||||
throw new Error('AsyncCallbackHook: Request replaced!', { cause: e });
|
||||
}
|
||||
|
||||
if (alive()) {
|
||||
|
||||
@@ -62,18 +62,12 @@ export const useAuthenticatedMediaUrl = (
|
||||
* Creates an authenticated fetch function for media URLs.
|
||||
* Useful for components that need to load multiple images.
|
||||
*/
|
||||
export const useAuthenticatedMediaFetch = () => {
|
||||
const mx = useMatrixClient();
|
||||
|
||||
return useCallback(
|
||||
async (src: string, useAuthentication = true): Promise<string> => {
|
||||
try {
|
||||
return await resolveAuthenticatedMediaUrl(src, useAuthentication);
|
||||
} catch (error) {
|
||||
console.warn('[useAuthenticatedMediaFetch] Error fetching authenticated media:', error);
|
||||
return src;
|
||||
}
|
||||
},
|
||||
[mx],
|
||||
);
|
||||
};
|
||||
export const useAuthenticatedMediaFetch = () =>
|
||||
useCallback(async (src: string, useAuthentication = true): Promise<string> => {
|
||||
try {
|
||||
return await resolveAuthenticatedMediaUrl(src, useAuthentication);
|
||||
} catch (error) {
|
||||
console.warn('[useAuthenticatedMediaFetch] Error fetching authenticated media:', error);
|
||||
return src;
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -61,7 +61,7 @@ export const useMemberPowerSort = (
|
||||
|
||||
return getPowerLevel(b.userId) - getPowerLevel(a.userId);
|
||||
},
|
||||
[creators],
|
||||
[creators, getPowerLevel],
|
||||
);
|
||||
|
||||
return sort;
|
||||
|
||||
@@ -281,15 +281,12 @@ export const useHomeHidden = (): [boolean, Dispatch<SetStateAction<boolean>>] =>
|
||||
|
||||
useAccountDataCallback(
|
||||
mx,
|
||||
useCallback(
|
||||
(mEvent) => {
|
||||
if (mEvent.getType() === AccountDataEvent.CinnySpaces) {
|
||||
const newContent = mEvent.getContent<InCinnySpacesContent>();
|
||||
setHomeHidden(newContent?.hideHome ?? false);
|
||||
}
|
||||
},
|
||||
[mx],
|
||||
),
|
||||
useCallback((mEvent) => {
|
||||
if (mEvent.getType() === AccountDataEvent.CinnySpaces) {
|
||||
const newContent = mEvent.getContent<InCinnySpacesContent>();
|
||||
setHomeHidden(newContent?.hideHome ?? false);
|
||||
}
|
||||
}, []),
|
||||
);
|
||||
|
||||
return [homeHidden, setHomeHidden];
|
||||
|
||||
Reference in New Issue
Block a user