diff --git a/src/screens/Moderation/index.tsx b/src/screens/Moderation/index.tsx index fd75efddf7..5674b2ebea 100644 --- a/src/screens/Moderation/index.tsx +++ b/src/screens/Moderation/index.tsx @@ -4,7 +4,7 @@ import {useFocusEffect} from '@react-navigation/native' import {ComAtprotoLabelDefs} from '@atproto/api' import {Trans, msg} from '@lingui/macro' import {useLingui} from '@lingui/react' -import {AppBskyLabelerDefs, LABELS} from '@atproto/api' +import {LABELS} from '@atproto/api' import {useSafeAreaFrame} from 'react-native-safe-area-context' import {NativeStackScreenProps, CommonNavigatorParams} from '#/lib/routes/types' @@ -86,16 +86,11 @@ export function ModerationScreen( error: preferencesError, data: preferences, } = usePreferencesQuery() - const { - isLoading: isLabelersLoading, - data: labelers, - error: labelersError, - } = useMyLabelers() const {gtMobile} = useBreakpoints() const {height} = useSafeAreaFrame() - const isLoading = isPreferencesLoading || isLabelersLoading - const error = preferencesError || labelersError + const isLoading = isPreferencesLoading + const error = preferencesError return ( ) : ( - + )} ) @@ -128,10 +123,8 @@ export function ModerationScreen( export function ModerationScreenInner({ preferences, - labelers = [], }: { preferences: UsePreferencesQueryResponse - labelers?: AppBskyLabelerDefs.LabelerViewDetailed[] }) { const {_} = useLingui() const t = useTheme() @@ -140,6 +133,11 @@ export function ModerationScreenInner({ const {gtMobile} = useBreakpoints() const {mutedWordsDialogControl} = useGlobalDialogsControlContext() const {openModal} = useModalControls() + const { + isLoading: isLabelersLoading, + data: labelers, + error: labelersError, + } = useMyLabelers() useFocusEffect( React.useCallback(() => { @@ -381,30 +379,43 @@ export function ModerationScreenInner({ ]}> Advanced - - {labelers.map((mod, i) => { - return ( - - {i !== 0 && } - - - - - - - - ) - })} - + + {isLabelersLoading ? ( + + ) : labelersError || !labelers ? ( + + + + We were unable to load your configured labelers at this time. + + + + ) : ( + + {labelers.map((mod, i) => { + return ( + + {i !== 0 && } + + + + + + + + ) + })} + + )}