File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ describe("VueQueryPlugin", () => {
4949 expect ( setupDevtoolsMock ) . toHaveBeenCalledTimes ( 0 ) ;
5050 } ) ;
5151
52- test ( "should setup devtools" , ( ) => {
52+ testIf ( isVue3 ) ( "should setup devtools" , ( ) => {
5353 const envCopy = process . env . NODE_ENV ;
5454 process . env . NODE_ENV = "development" ;
5555 const setupDevtoolsMock = setupDevtools as jest . Mock ;
Original file line number Diff line number Diff line change @@ -82,8 +82,6 @@ export const VueQueryPlugin = {
8282
8383 /* istanbul ignore next */
8484 if ( isVue2 ) {
85- // Workaround for Vue2 calling mixin multiple times
86- let devtoolsRegistered = false ;
8785 app . mixin ( {
8886 beforeCreate ( ) {
8987 // HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/master/src/apis/inject.ts#L30
@@ -103,10 +101,9 @@ export const VueQueryPlugin = {
103101 additionalClient . queryClient . mount ( ) ;
104102 } ) ;
105103
106- if ( ! devtoolsRegistered ) {
107- if ( process . env . NODE_ENV === "development" ) {
104+ if ( process . env . NODE_ENV === "development" ) {
105+ if ( this === this . $root ) {
108106 setupDevtools ( this , client ) ;
109- devtoolsRegistered = true ;
110107 }
111108 }
112109 } ,
@@ -119,9 +116,9 @@ export const VueQueryPlugin = {
119116 app . provide ( key , additionalClient . queryClient ) ;
120117 additionalClient . queryClient . mount ( ) ;
121118 } ) ;
122- }
123- if ( process . env . NODE_ENV === "development" ) {
124- setupDevtools ( app , client ) ;
119+ if ( process . env . NODE_ENV === "development" ) {
120+ setupDevtools ( app , client ) ;
121+ }
125122 }
126123 } ,
127124} ;
You can’t perform that action at this time.
0 commit comments