Fix empty moderation page

This commit is contained in:
Eric Bailey
2024-03-08 10:04:49 -06:00
parent 6ac4b6be5c
commit db14378cff
+7 -6
View File
@@ -81,14 +81,15 @@ export function ModerationScreen(
error: preferencesError, error: preferencesError,
data: preferences, data: preferences,
} = usePreferencesQuery() } = usePreferencesQuery()
const labelerDids = preferences
? preferences.moderationPrefs.labelers.map(l => l.did)
: []
const { const {
isLoading: isLabelersLoading, isLoading: isLabelersLoading,
data: labelers, data: labelers,
error: labelersError, error: labelersError,
} = useLabelersDetailedInfoQuery({ } = useLabelersDetailedInfoQuery({
dids: preferences dids: labelerDids,
? preferences.moderationPrefs.labelers.map(l => l.did)
: [],
}) })
const {gtMobile} = useBreakpoints() const {gtMobile} = useBreakpoints()
const {height} = useSafeAreaFrame() const {height} = useSafeAreaFrame()
@@ -111,7 +112,7 @@ export function ModerationScreen(
<View style={[a.w_full, a.align_center, a.pt_2xl]}> <View style={[a.w_full, a.align_center, a.pt_2xl]}>
<Loader size="xl" fill={t.atoms.text.color} /> <Loader size="xl" fill={t.atoms.text.color} />
</View> </View>
) : error || !(preferences && labelers) ? ( ) : error || !preferences ? (
<ErrorState <ErrorState
error={ error={
preferencesError?.toString() || preferencesError?.toString() ||
@@ -127,10 +128,10 @@ export function ModerationScreen(
export function ModerationScreenInner({ export function ModerationScreenInner({
preferences, preferences,
labelers, labelers = [],
}: { }: {
preferences: UsePreferencesQueryResponse preferences: UsePreferencesQueryResponse
labelers: AppBskyLabelerDefs.LabelerViewDetailed[] labelers?: AppBskyLabelerDefs.LabelerViewDetailed[]
}) { }) {
const t = useTheme() const t = useTheme()
const setMinimalShellMode = useSetMinimalShellMode() const setMinimalShellMode = useSetMinimalShellMode()