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)

pull/8679/head^2
Jeroen Reumkens 2023-05-05 17:42:47 +01:00 committed by GitHub
parent cdba1920fc
commit ab50067194
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

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 });