Fixed hydration errors

Moved some code to client only (it makes sense given the localstorage stuff)
This commit is contained in:
Alexis
2024-05-13 16:06:57 +02:00
parent b49b570fe2
commit df14fad98a
10 changed files with 82 additions and 39 deletions

View File

@@ -7,8 +7,8 @@ import {
type LeimPeriod,
type LeimPeriodShort
} from '@/models/Date'
import { useSessionStorage, useUrlSearchParams } from '@vueuse/core'
import { defineStore } from 'pinia'
import { useLocalStorage, useUrlSearchParams } from '@vueuse/core'
import { defineStore, skipHydrate } from 'pinia'
import { computed, ref, type ComputedRef, type Ref } from 'vue'
type CalendarViewType = 'month' | 'year' | 'decade' | 'century'
@@ -161,7 +161,7 @@ export const useCalendar = defineStore('calendar', () => {
}
})
const selectedDate = useSessionStorage<LeimDate>('selected-date', currentLeimDate.value, { deep: true })
const selectedDate = useLocalStorage<LeimDate>('selected-date', currentLeimDate.value, { deep: true })
/**
* Check whether the current viewType is active
@@ -393,7 +393,7 @@ export const useCalendar = defineStore('calendar', () => {
currentDate,
currentLeimDate,
defaultDate,
selectedDate,
selectedDate: skipHydrate(selectedDate),
selectDate,
params,
getPeriodOfYear,

View File

@@ -38,7 +38,6 @@ export const useCalendarEvents = defineStore('calendar-events', () => {
eventsAreLoading.value = false
}
}
fetchEvents()
/**
* Determines if the event can appear in the front end