Skip to content

Commit

Permalink
fix: vue2 devtools timeout error
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianOsipiuk committed Jul 14, 2022
1 parent f6a0a5d commit 4df81ed
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/vuejs/vueQueryPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export const VueQueryPlugin = {

/* istanbul ignore next */
if (isVue2) {
// Workaround for Vue2 calling mixin multiple times
let devtoolsRegistered = false;
app.mixin({
beforeCreate() {
// HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/master/src/apis/inject.ts#L30
Expand All @@ -87,10 +89,14 @@ export const VueQueryPlugin = {
set: (v) => Object.assign(provideCache, v),
});
}

this._provided[clientKey] = client;

if (process.env.NODE_ENV === "development") {
setupDevtools(this, client);
if (!devtoolsRegistered) {
if (process.env.NODE_ENV === "development") {
setupDevtools(this, client);
devtoolsRegistered = true;
}
}
},
});
Expand Down

0 comments on commit 4df81ed

Please sign in to comment.