From 8db442a34a7a426b2ae4c9d2ab2bd8cb625fb854 Mon Sep 17 00:00:00 2001 From: F4ilji Date: Tue, 7 Jul 2026 11:22:32 +0500 Subject: [PATCH] Revert "fix(ssr): add Vue lifecycle guard plugin to suppress browser API errors in SSR hooks" This reverts commit bb74bb48baf3de555c6d756124571794a7f50b77. --- resources/js/ssr.js | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/resources/js/ssr.js b/resources/js/ssr.js index 788c10d..23bdd2f 100755 --- a/resources/js/ssr.js +++ b/resources/js/ssr.js @@ -58,35 +58,10 @@ import { renderToString } from '@vue/server-renderer' import { createSSRApp, h } from 'vue' import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m'; import { Ziggy } from './ziggy'; -import { logSsrError } from './ssr/errorHandler.js'; +import { createSsrErrorHandler, logSsrError } from './ssr/errorHandler.js'; const EMPTY_RESPONSE = { head: [], body: '' }; -// Vue plugin that wraps lifecycle hooks with try-catch during SSR -// Prevents browser-only API errors (IntersectionObserver, $el, etc) from flooding logs -const ssrLifecycleGuard = { - install(app) { - const lifecycleHooks = ['mounted', 'updated', 'activated', 'deactivated', 'beforeUnmount', 'unmounted']; - const safeHooks = ['serverPrefetch']; - - app.mixin({ - ...Object.fromEntries(lifecycleHooks.map(hook => [hook, function (...args) { - try { - // Call original if defined in options - const original = this.$options?.[hook]; - if (typeof original === 'function') { - original.apply(this, args); - } else if (Array.isArray(original)) { - original.forEach(fn => fn.apply(this, args)); - } - } catch (e) { - // Suppress SSR lifecycle errors silently - } - }])), - }); - } -}; - createServer(page => createInertiaApp({ page, @@ -113,7 +88,6 @@ createServer(page => }; return ssrApp - .use(ssrLifecycleGuard) .use(plugin) .use(ZiggyVue, ziggyConfig); },