From de9abc0f722be7f8b5b9973909286ae3766a8dd6 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Fri, 12 Apr 2024 14:15:40 +0200 Subject: [PATCH] chore: playground --- playground/src/main.ts | 17 ++++- playground/src/pages/index.vue | 1 + playground/src/pages/index@named.vue | 8 ++ playground/src/pages/users/query.[id].vue | 93 +++++++++++++++++++++-- 4 files changed, 110 insertions(+), 9 deletions(-) diff --git a/playground/src/main.ts b/playground/src/main.ts index bbc38844..67fb5efc 100644 --- a/playground/src/main.ts +++ b/playground/src/main.ts @@ -5,7 +5,7 @@ import { createWebHistory, DataLoaderPlugin, } from 'vue-router/auto' -import { VueQueryPlugin } from '@tanstack/vue-query' +import { MutationCache, QueryCache, VueQueryPlugin } from '@tanstack/vue-query' import { createPinia } from 'pinia' import { QueryPlugin } from '@pinia/colada' @@ -21,7 +21,20 @@ const app = createApp(App) app.use(createPinia()) app.use(QueryPlugin) -app.use(VueQueryPlugin, {}) +app.use(VueQueryPlugin, { + queryClientConfig: { + mutationCache: new MutationCache({ + onSuccess(data, vars, context, mutation) { + // debugger + mutation + }, + async onSettled(...args) { + await new Promise((r) => setTimeout(r, 1000)) + console.log('global onSettled', ...args) + }, + }), + }, +}) app.use(DataLoaderPlugin, { router }) app.use(router) diff --git a/playground/src/pages/index.vue b/playground/src/pages/index.vue index 20c78000..4565747f 100644 --- a/playground/src/pages/index.vue +++ b/playground/src/pages/index.vue @@ -9,6 +9,7 @@ definePage({ diff --git a/playground/src/pages/index@named.vue b/playground/src/pages/index@named.vue index 71a4c055..e64bb745 100644 --- a/playground/src/pages/index@named.vue +++ b/playground/src/pages/index@named.vue @@ -1,3 +1,11 @@ + +