pl-hooks: Improve typings, update deps
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
2963504736
commit
eeaecf2d79
4 changed files with 14 additions and 16 deletions
|
@ -1,10 +1,10 @@
|
|||
import { useQueries, useQuery, type UseQueryResult } from '@tanstack/react-query';
|
||||
import { useQueries, useQuery, UseQueryOptions, type UseQueryResult } from '@tanstack/react-query';
|
||||
|
||||
import { usePlHooksApiClient } from 'pl-hooks/contexts/api-client';
|
||||
import { queryClient, usePlHooksQueryClient } from 'pl-hooks/contexts/query-client';
|
||||
import { importEntities } from 'pl-hooks/importer';
|
||||
import { usePoll } from 'pl-hooks/main';
|
||||
import { normalizeAccount, type NormalizedAccount } from 'pl-hooks/normalizers/account';
|
||||
import { type NormalizedAccount } from 'pl-hooks/normalizers/account';
|
||||
import { type NormalizedStatus, normalizeStatus } from 'pl-hooks/normalizers/status';
|
||||
|
||||
import type { Poll } from 'pl-api';
|
||||
|
@ -123,12 +123,9 @@ const useStatus = (statusId?: string, opts: UseStatusOpts = { withReblog: true }
|
|||
reblogQuery = useStatus(status?.reblog_id || undefined, { ...opts, withReblog: false });
|
||||
}
|
||||
|
||||
const accountsQuery = useQueries({
|
||||
const accountsQuery = useQueries<UseQueryOptions<NormalizedAccount>[]>({
|
||||
queries: status?.account_ids.map(accountId => ({
|
||||
queryKey: ['accounts', 'entities', accountId],
|
||||
queryFn: () => client.accounts.getAccount(accountId!)
|
||||
.then(account => (importEntities({ accounts: [account] }, { withParents: false }), account))
|
||||
.then(normalizeAccount),
|
||||
})) || [],
|
||||
}, queryClient);
|
||||
|
||||
|
|
|
@ -17,3 +17,4 @@ export * from './hooks/statuses/use-status-translation';
|
|||
export * from './importer';
|
||||
|
||||
export type { NormalizedAccount } from './normalizers/account';
|
||||
export type { NormalizedStatus } from './normalizers/status';
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
"vite-plugin-dts": "^4.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tanstack/react-query": "^5.56.2",
|
||||
"@tanstack/react-query": "^5.59.16",
|
||||
"lodash": "^4.17.21",
|
||||
"pl-api": "^0.1.1",
|
||||
"react": "^18.3.1",
|
||||
|
|
|
@ -381,17 +381,17 @@
|
|||
argparse "~1.0.9"
|
||||
string-argv "~0.3.1"
|
||||
|
||||
"@tanstack/query-core@5.56.2":
|
||||
version "5.56.2"
|
||||
resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-5.56.2.tgz#2def2fb0290cd2836bbb08afb0c175595bb8109b"
|
||||
integrity sha512-gor0RI3/R5rVV3gXfddh1MM+hgl0Z4G7tj6Xxpq6p2I03NGPaJ8dITY9Gz05zYYb/EJq9vPas/T4wn9EaDPd4Q==
|
||||
"@tanstack/query-core@5.59.16":
|
||||
version "5.59.16"
|
||||
resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-5.59.16.tgz#aa4616e8a9c12afeef4cfbf3ed0f55f404d66e67"
|
||||
integrity sha512-crHn+G3ltqb5JG0oUv6q+PMz1m1YkjpASrXTU+sYWW9pLk0t2GybUHNRqYPZWhxgjPaVGC4yp92gSFEJgYEsPw==
|
||||
|
||||
"@tanstack/react-query@^5.56.2":
|
||||
version "5.56.2"
|
||||
resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-5.56.2.tgz#3a0241b9d010910905382f5e99160997b8795f91"
|
||||
integrity sha512-SR0GzHVo6yzhN72pnRhkEFRAHMsUo5ZPzAxfTMvUxFIDVS6W9LYUp6nXW3fcHVdg0ZJl8opSH85jqahvm6DSVg==
|
||||
"@tanstack/react-query@^5.59.16":
|
||||
version "5.59.16"
|
||||
resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-5.59.16.tgz#1e701c6e6681965c04aa426df9da54b8edc6db1b"
|
||||
integrity sha512-MuyWheG47h6ERd4PKQ6V8gDyBu3ThNG22e1fRVwvq6ap3EqsFhyuxCAwhNP/03m/mLg+DAb0upgbPaX6VB+CkQ==
|
||||
dependencies:
|
||||
"@tanstack/query-core" "5.56.2"
|
||||
"@tanstack/query-core" "5.59.16"
|
||||
|
||||
"@types/argparse@1.0.38":
|
||||
version "1.0.38"
|
||||
|
|
Loading…
Reference in a new issue