File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
packages/use-dataloader/src Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -55,17 +55,12 @@ export const useInfiniteDataLoader = <
5555 getNextPage ? getNextPage ( ...params ) : undefined ,
5656 )
5757
58- const paramsRef = useRef ( {
59- ...baseParams ,
60- [ pageParamKey ] : page ,
61- } )
62-
63- paramsRef . current = {
58+ const paramsArgs = {
6459 ...baseParams ,
6560 [ pageParamKey ] : page ,
6661 }
6762
68- const getMethodRef = useRef ( ( ) => method ( paramsRef . current ) )
63+ const getMethodRef = useRef ( ( ) => method ( paramsArgs ) )
6964 const getOnSuccessRef = useRef (
7065 ( ...params : Parameters < NonNullable < typeof onSuccess > > ) =>
7166 onSuccess ?.( ...params ) ,
@@ -190,7 +185,8 @@ export const useInfiniteDataLoader = <
190185 } )
191186
192187 useEffect ( ( ) => {
193- request . method = ( ) => method ( paramsRef . current )
188+ request . method = ( ) => method ( paramsArgs )
189+ // eslint-disable-next-line react-hooks/exhaustive-deps
194190 } , [ method , request ] )
195191
196192 useEffect ( ( ) => {
@@ -215,13 +211,14 @@ export const useInfiniteDataLoader = <
215211 . then ( async result => {
216212 nextPageRef . current = getNextPageFnRef . current (
217213 result ,
218- paramsRef . current ,
214+ paramsArgs ,
219215 ) as typeof page
220216 await onSuccessLoad ( result )
221217 } )
222218 . catch ( onFailedLoad )
223219 }
224220 optimisticIsLoadingRef . current = false
221+ // eslint-disable-next-line react-hooks/exhaustive-deps
225222 } , [ needLoad , request ] )
226223
227224 useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments