Skip to content

Commit

Permalink
refactor(vue)!: append reset function to execute property (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
tien authored Oct 18, 2024
1 parent 98bb09e commit 485e3c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/vue/src/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const selectedChainId = ref<ChainId>("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
Expand Down
14 changes: 8 additions & 6 deletions packages/vue/src/composables/use-query-error-resetter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}),
};
}

0 comments on commit 485e3c8

Please sign in to comment.