From 422cc150808f2763a4996a40a0d30211b14fac73 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 26 Feb 2025 12:38:34 -0600 Subject: [PATCH] Add retry button --- .../moderation/ReportDialog/index.tsx | 31 ++++++++++++++----- src/state/queries/preferences/moderation.ts | 1 + 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/components/moderation/ReportDialog/index.tsx b/src/components/moderation/ReportDialog/index.tsx index 36422a853c..b8184b683d 100644 --- a/src/components/moderation/ReportDialog/index.tsx +++ b/src/components/moderation/ReportDialog/index.tsx @@ -14,10 +14,11 @@ import {useMyLabelersQuery} from '#/state/queries/preferences' import {CharProgress} from '#/view/com/composer/char-progress/CharProgress' import {UserAvatar} from '#/view/com/util/UserAvatar' import {atoms as a, useGutters, useTheme} from '#/alf' -import {Admonition} from '#/components/Admonition' +import * as Admonition from '#/components/Admonition' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {useDelayedLoading} from '#/components/hooks/useDelayedLoading' +import {ArrowRotateCounterClockwise_Stroke2_Corner0_Rounded as Retry} from '#/components/icons/ArrowRotateCounterClockwise' import { Check_Stroke2_Corner0_Rounded as CheckThin, CheckThick_Stroke2_Corner0_Rounded as Check, @@ -82,9 +83,10 @@ function Inner(props: ReportDialogProps) { const {_} = useLingui() const ref = React.useRef(null) const { - isLoading: isLabelerLoading, data: allLabelers, + isLoading: isLabelerLoading, error: labelersLoadError, + refetch: refetchLabelers, } = useMyLabelersQuery({excludeNonConfigurableLabelers: true}) const isLoading = useDelayedLoading(500, isLabelerLoading) const copy = useCopyForSubject(props.subject) @@ -186,9 +188,20 @@ function Inner(props: ReportDialogProps) { ) : labelersLoadError || !allLabelers ? ( - - Something went wrong, please try again. - + + + + + Something went wrong, please try again + + refetchLabelers()}> + Retry + + + + ) : ( <> {state.selectedOption ? ( @@ -321,12 +334,12 @@ function Inner(props: ReportDialogProps) { ) : ( // should never happen in our app - + Unfortunately, none of your subscribed labelers supports this report type. - + )} )} @@ -407,7 +420,9 @@ function Inner(props: ReportDialogProps) { {state.error && ( - {state.error} + + {state.error} + )} )} diff --git a/src/state/queries/preferences/moderation.ts b/src/state/queries/preferences/moderation.ts index 1b4de8bf22..a5cab18ddd 100644 --- a/src/state/queries/preferences/moderation.ts +++ b/src/state/queries/preferences/moderation.ts @@ -41,6 +41,7 @@ export function useMyLabelersQuery({ isLoading, error, data: labelers.data, + refetch: labelers.refetch, } }, [labelers, isLoading, error]) }