fix(ssr): polyfill localStorage/sessionStorage, guard BasicListBadge filters prop, remove this. from template

This commit is contained in:
F4ilji
2026-07-06 17:57:28 +05:00
parent eda69f4e37
commit 4c0152ae0f
4 changed files with 21 additions and 2 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ export default {
<BasicPageWrapper>
<BasicPageContainer>
<div class="space-y-5 md:space-y-4">
<ProgramTitle class="text-center" :header="this.campaignName" />
<ProgramTitle class="text-center" :header="campaignName" />
<div class="space-y-5 md:space-y-4 mx-auto max-w-3xl w-full">
<div>
<div class="">
@@ -21,7 +21,7 @@ export default {
name: "Index",
data() {
return {
favoriteGroups: JSON.parse(localStorage.getItem('favoriteGroups')),
favoriteGroups: typeof window !== 'undefined' ? JSON.parse(localStorage.getItem('favoriteGroups') || '[]') : [],
showFavorites: false,
loading: false,
currentPageLoaded: this.schedules_paginator.current_page,
@@ -48,6 +48,7 @@ export default {
props: {
filters: {
type: Object,
default: () => ({}),
},
},
}
+18
View File
@@ -7,6 +7,24 @@ if (typeof globalThis.IntersectionObserver === 'undefined') {
};
}
if (typeof globalThis.localStorage === 'undefined') {
const noop = () => '';
globalThis.localStorage = { getItem: noop, setItem: noop, removeItem: noop, clear: noop, get length() { return 0; }, key: noop };
}
if (typeof globalThis.sessionStorage === 'undefined') {
const noop = () => '';
globalThis.sessionStorage = { getItem: noop, setItem: noop, removeItem: noop, clear: noop, get length() { return 0; }, key: noop };
}
if (typeof globalThis.window === 'undefined') {
globalThis.window = globalThis;
}
if (typeof globalThis.document === 'undefined') {
globalThis.document = { createElement: () => ({ style: {} }), querySelector: () => null, head: { appendChild: () => {} }, body: { appendChild: () => {} } };
}
import '../css/app.css';
import { createInertiaApp } from '@inertiajs/vue3'
import createServer from '@inertiajs/vue3/server'