Просмотр исходного кода

Add SWRConfiguration support to useSWRINFxRecentThreads for enhanced configuration options

Shun Miyazawa 9 месяцев назад
Родитель
Сommit
8adb637bc2
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      apps/app/src/features/openai/client/stores/thread.tsx

+ 3 - 1
apps/app/src/features/openai/client/stores/thread.tsx

@@ -1,4 +1,4 @@
-import { type SWRResponse } from 'swr';
+import { type SWRResponse, type SWRConfiguration } from 'swr';
 import useSWRImmutable from 'swr/immutable';
 import useSWRInfinite from 'swr/infinite';
 import type { SWRInfiniteResponse } from 'swr/infinite';
@@ -41,11 +41,13 @@ const getRecentThreadsKey = (pageIndex: number, previousPageData: IThreadRelatio
 
 
 export const useSWRINFxRecentThreads = (
+    config?: SWRConfiguration,
 ): SWRInfiniteResponse<IThreadRelationPaginate, Error> => {
   return useSWRInfinite(
     (pageIndex, previousPageData) => getRecentThreadsKey(pageIndex, previousPageData),
     ([endpoint, page, limit]) => apiv3Get<IThreadRelationPaginate>(endpoint, { page, limit }).then(response => response.data),
     {
+      ...config,
       revalidateFirstPage: false,
       revalidateAll: true,
     },