From 17d260ba4e3db9f079e17c1946ea2c34344417be Mon Sep 17 00:00:00 2001 From: Zixuan Fan Date: Mon, 18 Aug 2025 18:11:20 +0800 Subject: [PATCH] fix: SWRMutationConfiguration.optimisticData types is not correct --- src/mutation/types.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mutation/types.ts b/src/mutation/types.ts index c3623b7ef..91f2ac721 100644 --- a/src/mutation/types.ts +++ b/src/mutation/types.ts @@ -29,7 +29,9 @@ export type SWRMutationConfiguration< populateCache?: | boolean | ((result: Data, currentData: SWRData | undefined) => SWRData) - optimisticData?: SWRData | ((currentData?: SWRData) => SWRData) + optimisticData?: + | Data + | ((currentData: Data | undefined, displayedData: Data | undefined) => Data) rollbackOnError?: boolean | ((error: unknown) => boolean) fetcher?: MutationFetcher onSuccess?: (