fix: suppress uncaught promise rejections from fire-and-forget useAsync calls in useEffect

This commit is contained in:
root
2026-05-15 19:07:13 -04:00
parent 7d57396de8
commit e9c7b9d600
5 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ export function AuthFlowsLoader({ fallback, error, children }: AuthFlowsLoaderPr
);
useEffect(() => {
load();
load().catch(() => {});
}, [load]);
if (state.status === AsyncStatus.Idle || state.status === AsyncStatus.Loading) {
+1 -1
View File
@@ -12,7 +12,7 @@ export function CapabilitiesLoader({ children }: CapabilitiesLoaderProps) {
const [state, load] = useAsyncCallback(useCallback(() => mx.getCapabilities(), [mx]));
useEffect(() => {
load();
load().catch(() => {});
}, [load]);
return children(state.status === AsyncStatus.Success ? state.data : undefined);
+1 -1
View File
@@ -12,7 +12,7 @@ export function MediaConfigLoader({ children }: MediaConfigLoaderProps) {
const [state, load] = useAsyncCallback(useCallback(() => mx.getMediaConfig(), [mx]));
useEffect(() => {
load();
load().catch(() => {});
}, [load]);
return children(state.status === AsyncStatus.Success ? state.data : undefined);
+1 -1
View File
@@ -22,7 +22,7 @@ export function SpecVersionsLoader({
const ignoreCallback = useCallback(() => setIgnoreError(true), []);
useEffect(() => {
load();
load().catch(() => {});
}, [load]);
if (state.status === AsyncStatus.Idle || state.status === AsyncStatus.Loading) {
@@ -28,7 +28,7 @@ export const UrlPreviewCard = as<'div', { url: string; ts: number }>(
);
useEffect(() => {
loadPreview();
loadPreview().catch(() => {});
}, [loadPreview]);
if (previewStatus.status === AsyncStatus.Error) return null;