Skip to content

Commit 16e73d0

Browse files
fix(devtools): vue2 devtools timeout error (#209)
1 parent f6a0a5d commit 16e73d0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/vuejs/vueQueryPlugin.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ export const VueQueryPlugin = {
7777

7878
/* istanbul ignore next */
7979
if (isVue2) {
80+
// Workaround for Vue2 calling mixin multiple times
81+
let devtoolsRegistered = false;
8082
app.mixin({
8183
beforeCreate() {
8284
// HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/master/src/apis/inject.ts#L30
@@ -87,10 +89,14 @@ export const VueQueryPlugin = {
8789
set: (v) => Object.assign(provideCache, v),
8890
});
8991
}
92+
9093
this._provided[clientKey] = client;
9194

92-
if (process.env.NODE_ENV === "development") {
93-
setupDevtools(this, client);
95+
if (!devtoolsRegistered) {
96+
if (process.env.NODE_ENV === "development") {
97+
setupDevtools(this, client);
98+
devtoolsRegistered = true;
99+
}
94100
}
95101
},
96102
});

0 commit comments

Comments
 (0)