@@ -633,38 +633,35 @@ export function buildHooks<Definitions extends EndpointDefinitions>({
633
633
} , [ subscriptionRemoved ] )
634
634
635
635
usePossiblyImmediateEffect ( ( ) : void | undefined => {
636
- batch ( ( ) => {
637
- const lastPromise = promiseRef . current
638
- if (
639
- typeof process !== 'undefined' &&
640
- process . env . NODE_ENV === 'removeMeOnCompilation'
641
- ) {
642
- // this is only present to enforce the rule of hooks to keep `isSubscribed` in the dependency array
643
- console . log ( subscriptionRemoved )
644
- }
636
+ const lastPromise = promiseRef . current
637
+ if (
638
+ typeof process !== 'undefined' &&
639
+ process . env . NODE_ENV === 'removeMeOnCompilation'
640
+ ) {
641
+ // this is only present to enforce the rule of hooks to keep `isSubscribed` in the dependency array
642
+ console . log ( subscriptionRemoved )
643
+ }
645
644
646
- if ( stableArg === skipToken ) {
647
- lastPromise ?. unsubscribe ( )
648
- promiseRef . current = undefined
649
- return
650
- }
645
+ if ( stableArg === skipToken ) {
646
+ lastPromise ?. unsubscribe ( )
647
+ promiseRef . current = undefined
648
+ return
649
+ }
651
650
652
- const lastSubscriptionOptions =
653
- promiseRef . current ?. subscriptionOptions
651
+ const lastSubscriptionOptions = promiseRef . current ?. subscriptionOptions
654
652
655
- if ( ! lastPromise || lastPromise . arg !== stableArg ) {
656
- lastPromise ?. unsubscribe ( )
657
- const promise = dispatch (
658
- initiate ( stableArg , {
659
- subscriptionOptions : stableSubscriptionOptions ,
660
- forceRefetch : refetchOnMountOrArgChange ,
661
- } )
662
- )
663
- promiseRef . current = promise
664
- } else if ( stableSubscriptionOptions !== lastSubscriptionOptions ) {
665
- lastPromise . updateSubscriptionOptions ( stableSubscriptionOptions )
666
- }
667
- } )
653
+ if ( ! lastPromise || lastPromise . arg !== stableArg ) {
654
+ lastPromise ?. unsubscribe ( )
655
+ const promise = dispatch (
656
+ initiate ( stableArg , {
657
+ subscriptionOptions : stableSubscriptionOptions ,
658
+ forceRefetch : refetchOnMountOrArgChange ,
659
+ } )
660
+ )
661
+ promiseRef . current = promise
662
+ } else if ( stableSubscriptionOptions !== lastSubscriptionOptions ) {
663
+ lastPromise . updateSubscriptionOptions ( stableSubscriptionOptions )
664
+ }
668
665
} , [
669
666
dispatch ,
670
667
initiate ,
0 commit comments