upgrade and refactor for react-query v5

This commit is contained in:
jeffvli
2025-11-02 01:16:53 -07:00
parent dd70d30cd3
commit 8115963264
94 changed files with 1650 additions and 1750 deletions
@@ -0,0 +1,22 @@
import { queryOptions } from '@tanstack/react-query';
import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys';
import { QueryHookArgs } from '/@/renderer/lib/react-query';
import { getServerById } from '/@/renderer/store';
import { SearchQuery } from '/@/shared/types/domain-types';
export const searchQueries = {
search: (args: QueryHookArgs<SearchQuery>) => {
return queryOptions({
queryFn: ({ signal }) => {
return api.controller.search({
apiClientProps: { server: getServerById(args.serverId), signal },
query: args.query,
});
},
queryKey: queryKeys.search.list(args.serverId || '', args.query),
...args.options,
});
},
};