瀏覽代碼

Add SWRConfiguration support to useSWRINFxRecentThreads for enhanced configuration options

Shun Miyazawa 10 月之前
父節點
當前提交
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 useSWRImmutable from 'swr/immutable';
 import useSWRInfinite from 'swr/infinite';
 import useSWRInfinite from 'swr/infinite';
 import type { SWRInfiniteResponse } from 'swr/infinite';
 import type { SWRInfiniteResponse } from 'swr/infinite';
@@ -41,11 +41,13 @@ const getRecentThreadsKey = (pageIndex: number, previousPageData: IThreadRelatio
 
 
 
 
 export const useSWRINFxRecentThreads = (
 export const useSWRINFxRecentThreads = (
+    config?: SWRConfiguration,
 ): SWRInfiniteResponse<IThreadRelationPaginate, Error> => {
 ): SWRInfiniteResponse<IThreadRelationPaginate, Error> => {
   return useSWRInfinite(
   return useSWRInfinite(
     (pageIndex, previousPageData) => getRecentThreadsKey(pageIndex, previousPageData),
     (pageIndex, previousPageData) => getRecentThreadsKey(pageIndex, previousPageData),
     ([endpoint, page, limit]) => apiv3Get<IThreadRelationPaginate>(endpoint, { page, limit }).then(response => response.data),
     ([endpoint, page, limit]) => apiv3Get<IThreadRelationPaginate>(endpoint, { page, limit }).then(response => response.data),
     {
     {
+      ...config,
       revalidateFirstPage: false,
       revalidateFirstPage: false,
       revalidateAll: true,
       revalidateAll: true,
     },
     },