From 20ea9831336133dc80b80fa16b6ae8ca11a3c9ce Mon Sep 17 00:00:00 2001 From: nicki182 Date: Tue, 17 Mar 2026 18:31:51 +0200 Subject: [PATCH 1/6] ssr implemented and pages not breaking when reloading --- frontend/app/components/SearchBar.vue | 4 ++-- frontend/app/components/feed/Feed.vue | 8 ++++---- frontend/app/components/footer/FooterWebsite.vue | 4 ++-- .../image-carousel/MediaImageCarouselFull.vue | 2 +- frontend/app/components/media/map/MediaMap.vue | 15 +++++++-------- .../app/components/media/map/MediaMapEvent.vue | 3 ++- frontend/app/components/page/PageBreadcrumbs.vue | 4 ++-- .../app/composables/generic/useBreakpoint.ts | 8 ++++++-- frontend/app/composables/map/useRoutingMap.ts | 6 +++--- frontend/app/constants/navMenuItems.ts | 1 - frontend/app/layouts/App.vue | 11 +++++++---- frontend/app/pages/events/[eventId]/about.vue | 4 ++-- frontend/app/pages/events/[eventId]/index.vue | 4 ++-- .../app/pages/organizations/[orgId]/about.vue | 4 ++-- .../[orgId]/groups/[groupId]/about.vue | 4 ++-- .../[orgId]/groups/[groupId]/index.vue | 4 ++-- .../app/pages/organizations/[orgId]/index.vue | 4 ++-- frontend/app/plugins/error-watcher.ts | 16 ++++++++++++++++ frontend/app/stores/dev.ts | 9 +++++++-- frontend/nuxt.config.ts | 8 ++++++-- frontend/test/composables/useBreakpoint.spec.ts | 6 +++--- 21 files changed, 80 insertions(+), 49 deletions(-) create mode 100644 frontend/app/plugins/error-watcher.ts diff --git a/frontend/app/components/SearchBar.vue b/frontend/app/components/SearchBar.vue index 7e997cc96..136075a26 100644 --- a/frontend/app/components/SearchBar.vue +++ b/frontend/app/components/SearchBar.vue @@ -110,11 +110,11 @@ const props = withDefaults(defineProps(), { expanded: false, }); -const localValue = ref(props.modelValue || ""); +const localValue = ref(props?.modelValue || ""); watch( props, (newVal) => { - localValue.value = newVal.modelValue || ""; + localValue.value = newVal?.modelValue || ""; }, { immediate: true } ); diff --git a/frontend/app/components/feed/Feed.vue b/frontend/app/components/feed/Feed.vue index 91c89c376..f02fd39f7 100644 --- a/frontend/app/components/feed/Feed.vue +++ b/frontend/app/components/feed/Feed.vue @@ -39,12 +39,12 @@ const feedItemUrls = computed(() => { } }); -const currentWidth = ref(window.innerWidth); +const currentWidth = ref(window?.innerWidth); const numberOfFeedItems = ref(1); let resizeTimeout: ReturnType | null = null; const updateWidth = () => { - currentWidth.value = window.innerWidth; + currentWidth.value = window?.innerWidth; if (currentWidth.value < BreakpointMap.SMALL) { numberOfFeedItems.value = 1; } else if (currentWidth.value < BreakpointMap.LARGE) { @@ -66,11 +66,11 @@ const handleResize = () => { }; onMounted(() => { - window.addEventListener("resize", handleResize); + window?.addEventListener?.("resize", handleResize); updateWidth(); }); onBeforeUnmount(() => { - window.removeEventListener("resize", handleResize); + window?.removeEventListener?.("resize", handleResize); }); diff --git a/frontend/app/components/footer/FooterWebsite.vue b/frontend/app/components/footer/FooterWebsite.vue index 4d9c79d7b..9f328a409 100644 --- a/frontend/app/components/footer/FooterWebsite.vue +++ b/frontend/app/components/footer/FooterWebsite.vue @@ -171,13 +171,13 @@ + \ No newline at end of file diff --git a/frontend/app/layouts/App.vue b/frontend/app/layouts/App.vue index 45e23134d..ee51e0481 100644 --- a/frontend/app/layouts/App.vue +++ b/frontend/app/layouts/App.vue @@ -2,17 +2,12 @@ \ No newline at end of file + diff --git a/frontend/app/layouts/App.vue b/frontend/app/layouts/App.vue index ee51e0481..acb92ac6c 100644 --- a/frontend/app/layouts/App.vue +++ b/frontend/app/layouts/App.vue @@ -2,9 +2,9 @@ diff --git a/frontend/app/stores/dev.ts b/frontend/app/stores/dev.ts index bf1145201..df02108a7 100644 --- a/frontend/app/stores/dev.ts +++ b/frontend/app/stores/dev.ts @@ -4,14 +4,16 @@ import { defineStore } from "pinia"; export const useDevMode = defineStore("devMode", { state: () => ({ // SSR: always false; Client: use localStorage - active: import.meta.server ? false : useLocalStorage("active", false), + active: import.meta.env.DEV, }), actions: { check() { if (import.meta.client) { this.active = window.location.href.includes(":3000"); + return; } + this.active = import.meta.env.DEV; }, }, });