Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

πŸ₯… Catch warning from ResizeObserver.prototype.unobserve

Alicia Sykes16704d81d1f2
diff --git a/src/main.js b/src/main.js
index 36017bed..9b8660fd 100644
--- a/src/main.js
+++ b/src/main.js
@@ -23,6 +23,7 @@ import { initHeaderAuth, isHeaderAuthEnabled } from '@/utils/HeaderAuth';
import { initOidcAuth, isOidcEnabled } from '@/utils/OidcAuth';
import Keys from '@/utils/StoreMutations';
import ErrorHandler from '@/utils/ErrorHandler';
+import '@/utils/patchResizeObserver';
// Setup i18n translations
const i18n = createI18n({
@@ -70,7 +71,6 @@ app.config.errorHandler = (err, instance, info) => {
ErrorHandler(`Vue error in ${info}`, err);
};
-
window.addEventListener('unhandledrejection', (event) => {
ErrorHandler('Unhandled promise rejection', event.reason);
});
diff --git a/src/utils/patchResizeObserver.js b/src/utils/patchResizeObserver.js
new file mode 100644
index 00000000..35a4773a
--- /dev/null
+++ b/src/utils/patchResizeObserver.js
@@ -0,0 +1,10 @@
+/* Patch `ResizeObserver.prototype.unobserve` to no-op on non-Element args.
+ * Works around @febe95/[email protected] passing a stale/null ref during
+ * component unmount. Safe to apply globally: `unobserve(null)` has no valid use. */
+if (typeof ResizeObserver !== 'undefined') {
+ const original = ResizeObserver.prototype.unobserve;
+ ResizeObserver.prototype.unobserve = function unobserve(target) {
+ if (target instanceof Element) return original.call(this, target);
+ return undefined;
+ };
+}