fix d5e6dfef72fdaee23fa295fc91c4bc789102eb33

This commit is contained in:
pa
2026-01-07 22:21:50 +09:00
committed by Natsumi
parent 882851b98f
commit 69cdc584eb
2 changed files with 18 additions and 14 deletions
-12
View File
@@ -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
View File
@@ -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);