mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
fix d5e6dfef72fdaee23fa295fc91c4bc789102eb33
This commit is contained in:
@@ -58,18 +58,6 @@ export function appendPiniaActionTrail(entry, maxEntries = 200) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function createPiniaActionTrailPlugin({ maxEntries = 200 } = {}) {
|
export function createPiniaActionTrailPlugin({ maxEntries = 200 } = {}) {
|
||||||
if (typeof window !== 'undefined') {
|
|
||||||
// @ts-ignore
|
|
||||||
if (!window.__VRCX_PINIA_ACTION_TRAIL__) {
|
|
||||||
// @ts-ignore
|
|
||||||
window.__VRCX_PINIA_ACTION_TRAIL__ = true;
|
|
||||||
|
|
||||||
window.addEventListener('beforeunload', () => {
|
|
||||||
clearPiniaActionTrail();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ({ store }) => {
|
return ({ store }) => {
|
||||||
store.$onAction(({ name }) => {
|
store.$onAction(({ name }) => {
|
||||||
appendPiniaActionTrail(
|
appendPiniaActionTrail(
|
||||||
|
|||||||
+18
-2
@@ -5,12 +5,16 @@ import { toast } from 'vue-sonner';
|
|||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import Noty from 'noty';
|
import Noty from 'noty';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
import {
|
||||||
|
clearPiniaActionTrail,
|
||||||
|
getPiniaActionTrail
|
||||||
|
} from '../plugin/piniaActionTrail';
|
||||||
import { debounce, parseLocation } from '../shared/utils';
|
import { debounce, parseLocation } from '../shared/utils';
|
||||||
import { AppDebug } from '../service/appConfig';
|
import { AppDebug } from '../service/appConfig';
|
||||||
import { database } from '../service/database';
|
import { database } from '../service/database';
|
||||||
import { failedGetRequests } from '../service/request';
|
import { failedGetRequests } from '../service/request';
|
||||||
import { getPiniaActionTrail } from '../plugin/piniaActionTrail';
|
|
||||||
import { refreshCustomScript } from '../shared/utils/base/ui';
|
import { refreshCustomScript } from '../shared/utils/base/ui';
|
||||||
import { useAdvancedSettingsStore } from './settings/advanced';
|
import { useAdvancedSettingsStore } from './settings/advanced';
|
||||||
import { useAvatarProviderStore } from './avatarProvider';
|
import { useAvatarProviderStore } from './avatarProvider';
|
||||||
@@ -528,7 +532,17 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
|||||||
if (advancedSettingsStore.sentryErrorReporting) {
|
if (advancedSettingsStore.sentryErrorReporting) {
|
||||||
try {
|
try {
|
||||||
import('@sentry/vue').then((Sentry) => {
|
import('@sentry/vue').then((Sentry) => {
|
||||||
const trail = getPiniaActionTrail();
|
const cutoff = dayjs().subtract(30, 'minute');
|
||||||
|
const trail = getPiniaActionTrail().filter((entry) => {
|
||||||
|
if (!entry || typeof entry.ts !== 'number') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const ts = dayjs(entry.ts);
|
||||||
|
if (!ts.isValid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return ts.isAfter(cutoff) || ts.isSame(cutoff);
|
||||||
|
});
|
||||||
Sentry.withScope((scope) => {
|
Sentry.withScope((scope) => {
|
||||||
scope.setLevel('fatal');
|
scope.setLevel('fatal');
|
||||||
scope.setTag('reason', 'crash-recovery');
|
scope.setTag('reason', 'crash-recovery');
|
||||||
@@ -540,6 +554,8 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
|||||||
`crash message: ${crashMessage}`
|
`crash message: ${crashMessage}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
clearPiniaActionTrail();
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error setting up Sentry feedback:', error);
|
console.error('Error setting up Sentry feedback:', error);
|
||||||
|
|||||||
Reference in New Issue
Block a user