Resolve the exhaustive-deps findings and attach cause to the rethrown errors. [skip build]
This commit is contained in:
@@ -472,7 +472,7 @@ export function TitleBar({ mx, children }: TitleBarProps) {
|
||||
mx.off(RoomEvent.Receipt, update);
|
||||
mx.off(ClientEvent.Room, update);
|
||||
};
|
||||
}, [mx, roomId, scheduleDismiss, notificationData, shouldNotifySpecialMessage]);
|
||||
}, [mx, roomId, scheduleDismiss, notificationData, shouldNotifySpecialMessage, mDirects]);
|
||||
|
||||
// Clear notifications when user reads messages in a room
|
||||
useEffect(() => {
|
||||
|
||||
@@ -176,7 +176,7 @@ export function IncomingCallNotification() {
|
||||
checkForIncomingCalls();
|
||||
}
|
||||
},
|
||||
[checkForIncomingCalls, declinedRooms, mx],
|
||||
[checkForIncomingCalls, mx],
|
||||
);
|
||||
|
||||
// Set up event listeners
|
||||
|
||||
@@ -1187,7 +1187,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
return () => {
|
||||
persistTimelineScroll(roomId);
|
||||
};
|
||||
}, [room.roomId, persistTimelineScroll]);
|
||||
}, [room, persistTimelineScroll]);
|
||||
|
||||
// Keep scroll cache updated while reading (useEffect cleanup runs after DOM teardown).
|
||||
useEffect(() => {
|
||||
@@ -1216,7 +1216,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
window.cancelAnimationFrame(raf);
|
||||
scrollEl.removeEventListener('scroll', onScroll);
|
||||
};
|
||||
}, [room.roomId, eventId, persistTimelineScroll]);
|
||||
}, [room, eventId, persistTimelineScroll]);
|
||||
|
||||
// Restore saved scroll or default to bottom on first open.
|
||||
useLayoutEffect(() => {
|
||||
|
||||
@@ -726,13 +726,7 @@ export function Audio({ requestClose }: AudioProps) {
|
||||
console.error('Microphone monitoring failed:', e);
|
||||
}
|
||||
}
|
||||
}, [
|
||||
micMonitoring,
|
||||
settings.microphoneId,
|
||||
settings.noiseSuppression,
|
||||
settings.echoCancellation,
|
||||
settings.autoGainControl,
|
||||
]);
|
||||
}, [micMonitoring, settings]);
|
||||
|
||||
// Cleanup monitoring on unmount
|
||||
useEffect(
|
||||
|
||||
@@ -52,11 +52,9 @@ export function Permissions({ requestClose }: PermissionsProps) {
|
||||
useRecursiveChildScopeFactory(mx, roomToParents),
|
||||
);
|
||||
|
||||
// Combine both spaces and rooms for syncing
|
||||
const allChildren = [...childSpaces, ...childRooms];
|
||||
|
||||
// Calculate which children we can sync to
|
||||
const { syncableChildren, nonSyncableChildren } = useMemo(() => {
|
||||
const allChildren = [...childSpaces, ...childRooms];
|
||||
const syncable: string[] = [];
|
||||
const nonSyncable: { roomId: string; name: string }[] = [];
|
||||
|
||||
@@ -97,7 +95,7 @@ export function Permissions({ requestClose }: PermissionsProps) {
|
||||
});
|
||||
|
||||
return { syncableChildren: syncable, nonSyncableChildren: nonSyncable };
|
||||
}, [allChildren, mx]);
|
||||
}, [childSpaces, childRooms, mx]);
|
||||
|
||||
const [syncState, syncPermissions] = useAsyncCallback(
|
||||
useCallback(async () => {
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -16,11 +16,6 @@ export function SSOLogin({ providers, redirectUrl, action, saveScreenSpace }: SS
|
||||
const mx = useMemo(() => createClient({ baseUrl }), [baseUrl]);
|
||||
const [launchingProviderId, setLaunchingProviderId] = useState<string | null>(null);
|
||||
|
||||
const getSSOIdUrl = (ssoId?: string): string => {
|
||||
const existingDeviceId = localStorage.getItem('cinny_device_id') ?? undefined;
|
||||
return mx.getSsoLoginUrl(redirectUrl, 'sso', ssoId, action, existingDeviceId);
|
||||
};
|
||||
|
||||
const handleContinue = useCallback(
|
||||
async (providerId?: string) => {
|
||||
if (launchingProviderId) {
|
||||
@@ -39,12 +34,15 @@ export function SSOLogin({ providers, redirectUrl, action, saveScreenSpace }: SS
|
||||
}
|
||||
|
||||
try {
|
||||
await openExternalUrl(getSSOIdUrl(providerId));
|
||||
const existingDeviceId = localStorage.getItem('cinny_device_id') ?? undefined;
|
||||
await openExternalUrl(
|
||||
mx.getSsoLoginUrl(redirectUrl, 'sso', providerId, action, existingDeviceId),
|
||||
);
|
||||
} finally {
|
||||
setLaunchingProviderId(null);
|
||||
}
|
||||
},
|
||||
[getSSOIdUrl, launchingProviderId],
|
||||
[mx, redirectUrl, action, launchingProviderId],
|
||||
);
|
||||
|
||||
const withoutIcon = providers
|
||||
|
||||
@@ -345,6 +345,7 @@ export const initClient = async (session: Session): Promise<MatrixClient> => {
|
||||
`❌ Crypto store conflict detected.\n\n` +
|
||||
`This account's crypto store contains data from a different account.\n` +
|
||||
`Please clear site data in DevTools (F12 → Application → Storage → Clear site data)`,
|
||||
{ cause: error },
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
"outDir": "dist",
|
||||
"rootDir": "./src",
|
||||
"skipLibCheck": true,
|
||||
"lib": ["ES2020", "DOM"]
|
||||
"lib": ["ES2022", "DOM"]
|
||||
},
|
||||
"exclude": ["node_modules", "dist"],
|
||||
"include": ["src"]
|
||||
|
||||
Reference in New Issue
Block a user