mirror of https://github.com/tooot-app/app
Fix wrong query key
This commit is contained in:
parent
fc06e4c629
commit
b70ca924a1
|
@ -81,7 +81,7 @@ const TabSharedAccount: React.FC<TabSharedStackScreenProps<'Tab-Shared-Account'>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, [])
|
}, [mAccount])
|
||||||
|
|
||||||
const { data } = useAccountQuery({ id: account.id })
|
const { data } = useAccountQuery({ id: account.id })
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,8 @@ const TabSharedAccountInLists: React.FC<
|
||||||
id: 'out',
|
id: 'out',
|
||||||
title: t('shared.accountInLists.notInLists'),
|
title: t('shared.accountInLists.notInLists'),
|
||||||
data:
|
data:
|
||||||
listsQuery?.data?.filter(
|
listsQuery.data?.filter(
|
||||||
({ id }) => !accountInListsQuery?.data?.filter(d => d.id === id)?.length
|
({ id }) => accountInListsQuery.data?.filter(d => d.id !== id).length
|
||||||
) || []
|
) || []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -27,7 +27,9 @@ const useAccountQuery = ({
|
||||||
|
|
||||||
export type QueryKeyAccountInLists = ['AccountInLists', { id: Mastodon.Account['id'] }]
|
export type QueryKeyAccountInLists = ['AccountInLists', { id: Mastodon.Account['id'] }]
|
||||||
|
|
||||||
const accountInListsQueryFunction = ({ queryKey }: QueryFunctionContext<QueryKeyAccount>) => {
|
const accountInListsQueryFunction = ({
|
||||||
|
queryKey
|
||||||
|
}: QueryFunctionContext<QueryKeyAccountInLists>) => {
|
||||||
const { id } = queryKey[1]
|
const { id } = queryKey[1]
|
||||||
|
|
||||||
return apiInstance<Mastodon.List[]>({
|
return apiInstance<Mastodon.List[]>({
|
||||||
|
@ -42,7 +44,7 @@ const useAccountInListsQuery = ({
|
||||||
}: QueryKeyAccount[1] & {
|
}: QueryKeyAccount[1] & {
|
||||||
options?: UseQueryOptions<Mastodon.List[], AxiosError>
|
options?: UseQueryOptions<Mastodon.List[], AxiosError>
|
||||||
}) => {
|
}) => {
|
||||||
const queryKey: QueryKeyAccount = ['Account', { ...queryKeyParams }]
|
const queryKey: QueryKeyAccountInLists = ['AccountInLists', { ...queryKeyParams }]
|
||||||
return useQuery(queryKey, accountInListsQueryFunction, options)
|
return useQuery(queryKey, accountInListsQueryFunction, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue