Skip to content

Commit

Permalink
feat: 在上一次错误弹窗关闭后3s内不记录新的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
simply-none committed Jan 19, 2024
1 parent d0ad3f9 commit d550607
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/stores/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { defineStore, storeToRefs } from "pinia";
export const useErrorStore = defineStore("error", () => {
let errorList = ref();
let errorListCache = ref([]);
let errLastTime = ref()

watch(() => errorList.value, (n, o) => {
console.log('监听dexie错误', n, o)
Expand All @@ -25,6 +26,9 @@ export const useErrorStore = defineStore("error", () => {
if (errorList.value && errorList.value.length >= 50) {
return false
}
if (errLastTime.value && Math.abs(errLastTime.value - Date.now()) < 3000) {
return false
}
err = {
msg: err.message,
stack: err.stack.toString()
Expand All @@ -37,6 +41,7 @@ export const useErrorStore = defineStore("error", () => {
function clearError() {
errorList.value = null;
console.log(errorList.value)
errLastTime.value = Date.now()

}

Expand Down

0 comments on commit d550607

Please sign in to comment.