Set selecteddate to today when switching layout. Before we were getting the current layout from the store, which would actually be the OLD layout you were switching from 😅 (#8711)

This commit is contained in:
Jeroen Reumkens
2023-05-05 16:42:47 +00:00
committed by GitHub
parent cdba1920fc
commit ab50067194
+1 -1
View File
@@ -101,7 +101,7 @@ export const useBookerStore = create<BookerStore>((set, get) => ({
setLayout: (layout: BookerLayout) => {
// If we switch to a large layout and don't have a date selected yet,
// we selected it here, so week title is rendered properly.
if (["large_calendar", "large_timeslots"].includes(get().layout) && !get().selectedDate) {
if (["large_calendar", "large_timeslots"].includes(layout) && !get().selectedDate) {
set({ selectedDate: dayjs().format("YYYY-MM-DD") });
}
return set({ layout });