mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 08:12:00 +02:00
💽 refactor(client): Optimize ModelsConfig Query Cache (#2330)
* refactor(client): remove double caching of models via recoil to rely exclusively on react-query * chore(useConversation): add modelsQuery.data dep to callback
This commit is contained in:
parent
fb80af05be
commit
f6a84887e1
11 changed files with 76 additions and 94 deletions
|
@ -6,13 +6,13 @@ import {
|
|||
UseMutationResult,
|
||||
QueryObserverResult,
|
||||
} from '@tanstack/react-query';
|
||||
import * as t from '../types';
|
||||
import * as s from '../schemas';
|
||||
import * as m from '../types/mutations';
|
||||
import { defaultOrderQuery } from '../config';
|
||||
import { defaultOrderQuery, initialModelsConfig } from '../config';
|
||||
import * as dataService from '../data-service';
|
||||
import request from '../request';
|
||||
import * as m from '../types/mutations';
|
||||
import { QueryKeys } from '../keys';
|
||||
import request from '../request';
|
||||
import * as s from '../schemas';
|
||||
import * as t from '../types';
|
||||
|
||||
export const useAbortRequestWithMessage = (): UseMutationResult<
|
||||
void,
|
||||
|
@ -211,10 +211,11 @@ export const useGetModelsQuery = (
|
|||
config?: UseQueryOptions<t.TModelsConfig>,
|
||||
): QueryObserverResult<t.TModelsConfig> => {
|
||||
return useQuery<t.TModelsConfig>([QueryKeys.models], () => dataService.getModels(), {
|
||||
staleTime: Infinity,
|
||||
initialData: initialModelsConfig,
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
refetchOnMount: false,
|
||||
staleTime: Infinity,
|
||||
...config,
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue