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(RoomEvent.Receipt, update);
|
||||||
mx.off(ClientEvent.Room, 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
|
// Clear notifications when user reads messages in a room
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ export function IncomingCallNotification() {
|
|||||||
checkForIncomingCalls();
|
checkForIncomingCalls();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[checkForIncomingCalls, declinedRooms, mx],
|
[checkForIncomingCalls, mx],
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set up event listeners
|
// Set up event listeners
|
||||||
|
|||||||
@@ -1187,7 +1187,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
|||||||
return () => {
|
return () => {
|
||||||
persistTimelineScroll(roomId);
|
persistTimelineScroll(roomId);
|
||||||
};
|
};
|
||||||
}, [room.roomId, persistTimelineScroll]);
|
}, [room, persistTimelineScroll]);
|
||||||
|
|
||||||
// Keep scroll cache updated while reading (useEffect cleanup runs after DOM teardown).
|
// Keep scroll cache updated while reading (useEffect cleanup runs after DOM teardown).
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -1216,7 +1216,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
|||||||
window.cancelAnimationFrame(raf);
|
window.cancelAnimationFrame(raf);
|
||||||
scrollEl.removeEventListener('scroll', onScroll);
|
scrollEl.removeEventListener('scroll', onScroll);
|
||||||
};
|
};
|
||||||
}, [room.roomId, eventId, persistTimelineScroll]);
|
}, [room, eventId, persistTimelineScroll]);
|
||||||
|
|
||||||
// Restore saved scroll or default to bottom on first open.
|
// Restore saved scroll or default to bottom on first open.
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
|
|||||||
@@ -726,13 +726,7 @@ export function Audio({ requestClose }: AudioProps) {
|
|||||||
console.error('Microphone monitoring failed:', e);
|
console.error('Microphone monitoring failed:', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [
|
}, [micMonitoring, settings]);
|
||||||
micMonitoring,
|
|
||||||
settings.microphoneId,
|
|
||||||
settings.noiseSuppression,
|
|
||||||
settings.echoCancellation,
|
|
||||||
settings.autoGainControl,
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Cleanup monitoring on unmount
|
// Cleanup monitoring on unmount
|
||||||
useEffect(
|
useEffect(
|
||||||
|
|||||||
@@ -52,11 +52,9 @@ export function Permissions({ requestClose }: PermissionsProps) {
|
|||||||
useRecursiveChildScopeFactory(mx, roomToParents),
|
useRecursiveChildScopeFactory(mx, roomToParents),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Combine both spaces and rooms for syncing
|
|
||||||
const allChildren = [...childSpaces, ...childRooms];
|
|
||||||
|
|
||||||
// Calculate which children we can sync to
|
// Calculate which children we can sync to
|
||||||
const { syncableChildren, nonSyncableChildren } = useMemo(() => {
|
const { syncableChildren, nonSyncableChildren } = useMemo(() => {
|
||||||
|
const allChildren = [...childSpaces, ...childRooms];
|
||||||
const syncable: string[] = [];
|
const syncable: string[] = [];
|
||||||
const nonSyncable: { roomId: string; name: string }[] = [];
|
const nonSyncable: { roomId: string; name: string }[] = [];
|
||||||
|
|
||||||
@@ -97,7 +95,7 @@ export function Permissions({ requestClose }: PermissionsProps) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return { syncableChildren: syncable, nonSyncableChildren: nonSyncable };
|
return { syncableChildren: syncable, nonSyncableChildren: nonSyncable };
|
||||||
}, [allChildren, mx]);
|
}, [childSpaces, childRooms, mx]);
|
||||||
|
|
||||||
const [syncState, syncPermissions] = useAsyncCallback(
|
const [syncState, syncPermissions] = useAsyncCallback(
|
||||||
useCallback(async () => {
|
useCallback(async () => {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export const useAsync = <TData, TError, TArgs extends unknown[]>(
|
|||||||
return data;
|
return data;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (currentReqNumber !== reqNumberRef.current) {
|
if (currentReqNumber !== reqNumberRef.current) {
|
||||||
throw new Error('AsyncCallbackHook: Request replaced!');
|
throw new Error('AsyncCallbackHook: Request replaced!', { cause: e });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alive()) {
|
if (alive()) {
|
||||||
|
|||||||
@@ -62,18 +62,12 @@ export const useAuthenticatedMediaUrl = (
|
|||||||
* Creates an authenticated fetch function for media URLs.
|
* Creates an authenticated fetch function for media URLs.
|
||||||
* Useful for components that need to load multiple images.
|
* Useful for components that need to load multiple images.
|
||||||
*/
|
*/
|
||||||
export const useAuthenticatedMediaFetch = () => {
|
export const useAuthenticatedMediaFetch = () =>
|
||||||
const mx = useMatrixClient();
|
useCallback(async (src: string, useAuthentication = true): Promise<string> => {
|
||||||
|
try {
|
||||||
return useCallback(
|
return await resolveAuthenticatedMediaUrl(src, useAuthentication);
|
||||||
async (src: string, useAuthentication = true): Promise<string> => {
|
} catch (error) {
|
||||||
try {
|
console.warn('[useAuthenticatedMediaFetch] Error fetching authenticated media:', error);
|
||||||
return await resolveAuthenticatedMediaUrl(src, useAuthentication);
|
return src;
|
||||||
} catch (error) {
|
}
|
||||||
console.warn('[useAuthenticatedMediaFetch] Error fetching authenticated media:', error);
|
}, []);
|
||||||
return src;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[mx],
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export const useMemberPowerSort = (
|
|||||||
|
|
||||||
return getPowerLevel(b.userId) - getPowerLevel(a.userId);
|
return getPowerLevel(b.userId) - getPowerLevel(a.userId);
|
||||||
},
|
},
|
||||||
[creators],
|
[creators, getPowerLevel],
|
||||||
);
|
);
|
||||||
|
|
||||||
return sort;
|
return sort;
|
||||||
|
|||||||
@@ -281,15 +281,12 @@ export const useHomeHidden = (): [boolean, Dispatch<SetStateAction<boolean>>] =>
|
|||||||
|
|
||||||
useAccountDataCallback(
|
useAccountDataCallback(
|
||||||
mx,
|
mx,
|
||||||
useCallback(
|
useCallback((mEvent) => {
|
||||||
(mEvent) => {
|
if (mEvent.getType() === AccountDataEvent.CinnySpaces) {
|
||||||
if (mEvent.getType() === AccountDataEvent.CinnySpaces) {
|
const newContent = mEvent.getContent<InCinnySpacesContent>();
|
||||||
const newContent = mEvent.getContent<InCinnySpacesContent>();
|
setHomeHidden(newContent?.hideHome ?? false);
|
||||||
setHomeHidden(newContent?.hideHome ?? false);
|
}
|
||||||
}
|
}, []),
|
||||||
},
|
|
||||||
[mx],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return [homeHidden, setHomeHidden];
|
return [homeHidden, setHomeHidden];
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ export function SSOLogin({ providers, redirectUrl, action, saveScreenSpace }: SS
|
|||||||
const mx = useMemo(() => createClient({ baseUrl }), [baseUrl]);
|
const mx = useMemo(() => createClient({ baseUrl }), [baseUrl]);
|
||||||
const [launchingProviderId, setLaunchingProviderId] = useState<string | null>(null);
|
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(
|
const handleContinue = useCallback(
|
||||||
async (providerId?: string) => {
|
async (providerId?: string) => {
|
||||||
if (launchingProviderId) {
|
if (launchingProviderId) {
|
||||||
@@ -39,12 +34,15 @@ export function SSOLogin({ providers, redirectUrl, action, saveScreenSpace }: SS
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await openExternalUrl(getSSOIdUrl(providerId));
|
const existingDeviceId = localStorage.getItem('cinny_device_id') ?? undefined;
|
||||||
|
await openExternalUrl(
|
||||||
|
mx.getSsoLoginUrl(redirectUrl, 'sso', providerId, action, existingDeviceId),
|
||||||
|
);
|
||||||
} finally {
|
} finally {
|
||||||
setLaunchingProviderId(null);
|
setLaunchingProviderId(null);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[getSSOIdUrl, launchingProviderId],
|
[mx, redirectUrl, action, launchingProviderId],
|
||||||
);
|
);
|
||||||
|
|
||||||
const withoutIcon = providers
|
const withoutIcon = providers
|
||||||
|
|||||||
@@ -345,6 +345,7 @@ export const initClient = async (session: Session): Promise<MatrixClient> => {
|
|||||||
`❌ Crypto store conflict detected.\n\n` +
|
`❌ Crypto store conflict detected.\n\n` +
|
||||||
`This account's crypto store contains data from a different account.\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)`,
|
`Please clear site data in DevTools (F12 → Application → Storage → Clear site data)`,
|
||||||
|
{ cause: error },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"lib": ["ES2020", "DOM"]
|
"lib": ["ES2022", "DOM"]
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "dist"],
|
"exclude": ["node_modules", "dist"],
|
||||||
"include": ["src"]
|
"include": ["src"]
|
||||||
|
|||||||
Reference in New Issue
Block a user