From 46076c4afb8050325912afe825d27c9efd1e736c Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 13 Feb 2024 18:00:41 -0600 Subject: [PATCH] Some validation, fixes --- .../PreferenceRow.tsx | 10 ++++++---- src/state/queries/modservice.ts | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/screens/ProfileModerationService/PreferenceRow.tsx b/src/screens/ProfileModerationService/PreferenceRow.tsx index 16f3d83f15..77b37931a6 100644 --- a/src/screens/ProfileModerationService/PreferenceRow.tsx +++ b/src/screens/ProfileModerationService/PreferenceRow.tsx @@ -1,8 +1,8 @@ import React from 'react' import {View} from 'react-native' import {useLingui} from '@lingui/react' -import {msg} from '@lingui/macro' -import {LABEL_GROUPS, AppBskyModerationDefs} from '@atproto/api' +// import {msg} from '@lingui/macro' +import {LABEL_GROUPS} from '@atproto/api' // TODO import {ModPrefItem} from '@atproto/api/dist/client/types/app/bsky/actor/defs' @@ -24,7 +24,7 @@ export function PreferenceRow({ const {_} = useLingui() const labelGroupStrings = useLabelGroupStrings() const groupInfoStrings = labelGroupStrings[labelGroup] - const {mutateAsync, variables} = useModServiceLabelGroupEnableMutation() + const {mutateAsync, variables, reset} = useModServiceLabelGroupEnableMutation() const enabled = variables?.enabled ?? !modservicePreferences?.disabledLabelGroups?.includes(labelGroup) @@ -37,10 +37,12 @@ export function PreferenceRow({ group: labelGroup, enabled: !enabled, }) + reset() // Important: clears query `variables` } catch (e: any) { + // TODO console.error(e) } - }, [mutateAsync, enabled]) + }, [mutateAsync, enabled, modservicePreferences, labelGroup, reset]) return (