File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -199,13 +199,19 @@ export function useInfiniteSubscription<
199199 refetchOnMount : true ,
200200 refetchOnWindowFocus : false ,
201201 refetchOnReconnect : false ,
202- onSuccess : options . onData ,
203202 onError : ( error : TError ) => {
204203 clearErrors ( ) ;
205204 options . onError && options . onError ( error ) ;
206205 } ,
207206 } ) ;
208207
208+ useEffect ( ( ) => {
209+ if ( queryResult . isSuccess ) {
210+ options . onData ?.( queryResult . data ) ;
211+ }
212+ // eslint-disable-next-line react-hooks/exhaustive-deps
213+ } , [ queryResult . data ] ) ;
214+
209215 useEffect ( ( ) => {
210216 return function cleanup ( ) {
211217 // Fixes unsubscribe
Original file line number Diff line number Diff line change @@ -135,13 +135,19 @@ export function useSubscription<
135135 refetchOnMount : true ,
136136 refetchOnWindowFocus : false ,
137137 refetchOnReconnect : false ,
138- onSuccess : options . onData ,
139138 onError : ( error : TError ) => {
140139 clearErrors ( ) ;
141140 options . onError && options . onError ( error ) ;
142141 } ,
143142 } ) ;
144143
144+ useEffect ( ( ) => {
145+ if ( queryResult . isSuccess ) {
146+ options . onData ?.( queryResult . data ) ;
147+ }
148+ // eslint-disable-next-line react-hooks/exhaustive-deps
149+ } , [ queryResult . data ] ) ;
150+
145151 useEffect ( ( ) => {
146152 return function cleanup ( ) {
147153 // Fixes unsubscribe
You can’t perform that action at this time.
0 commit comments