From 485e3c8c32fe3873df4fa8da6fc0434a25784143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ti=E1=BA=BFn=20Nguy=E1=BB=85n=20Kh=E1=BA=AFc?= Date: Fri, 18 Oct 2024 21:05:48 +1300 Subject: [PATCH] refactor(vue)!: append reset function to execute property (#268) --- examples/vue/src/app.vue | 2 +- .../src/composables/use-query-error-resetter.ts | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/examples/vue/src/app.vue b/examples/vue/src/app.vue index db4a7aa1..061692d4 100644 --- a/examples/vue/src/app.vue +++ b/examples/vue/src/app.vue @@ -16,7 +16,7 @@ const selectedChainId = ref("polkadot"); provideChain(selectedChainId); const hasError = ref(false); -const resetError = useQueryErrorResetter(); +const { execute: resetError } = useQueryErrorResetter(); onErrorCaptured(() => (hasError.value = true)); // Useful tracking all submitted transaction, i.e. for toast notification diff --git a/packages/vue/src/composables/use-query-error-resetter.ts b/packages/vue/src/composables/use-query-error-resetter.ts index 08016fe6..b84fe948 100644 --- a/packages/vue/src/composables/use-query-error-resetter.ts +++ b/packages/vue/src/composables/use-query-error-resetter.ts @@ -9,10 +9,12 @@ import { toValue } from "vue"; export function useQueryErrorResetter() { const cache = useLazyValuesCache(); - return () => - toValue(cache).forEach((value, key) => { - if (erroredSymbol in value) { - toValue(cache).delete(key); - } - }); + return { + execute: () => + toValue(cache).forEach((value, key) => { + if (erroredSymbol in value) { + toValue(cache).delete(key); + } + }), + }; }