|
|
@@ -317,6 +317,30 @@ function setDocumentLangPackProperties(langPack: LangPackDifference.langPackDiff
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 全局错误处理器 - 当出现特定错误时自动刷新页面
|
|
|
+window.addEventListener('error', (event) => {
|
|
|
+ const error = event.error;
|
|
|
+ if(error && error.message && error.message.includes('Cannot read properties of undefined (reading \'_\')')) {
|
|
|
+ console.warn('检测到消息过滤错误,正在刷新页面...');
|
|
|
+ // 延迟一点时间以确保日志输出
|
|
|
+ setTimeout(() => {
|
|
|
+ window.location.reload();
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+// 处理 Promise 中的未捕获错误
|
|
|
+window.addEventListener('unhandledrejection', (event) => {
|
|
|
+ const error = event.reason;
|
|
|
+ if(error && error.message && error.message.includes('Cannot read properties of undefined (reading \'_\')')) {
|
|
|
+ console.warn('检测到 Promise 中的消息过滤错误,正在刷新页面...');
|
|
|
+ // 延迟一点时间以确保日志输出
|
|
|
+ setTimeout(() => {
|
|
|
+ window.location.reload();
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
(window as any)['showIconLibrary'] = async() => {
|
|
|
const {showIconLibrary} = await import('./components/iconLibrary/trigger');
|
|
|
showIconLibrary();
|