Fix initialization logic

This commit is contained in:
scottkiener-at-safelite 2026-05-29 12:17:47 -04:00
parent 0bed421da3
commit b1cdb3be87

View file

@ -150,7 +150,7 @@ export default {
if (!newDates.length) return;
if (!this.initialized && !this.modelValue) {
this.initializeWindow();
this.initialize();
return;
}
// Pending auto select is set when the user is at the end of the dates and the next page of dates is loaded.
@ -170,8 +170,9 @@ export default {
const index = this.allDates.findIndex((d) => d.value === this.modelValue);
if (index !== -1) this.windowStart = this.getWindowStartFromIndex(index);
} else {
this.initializeWindow();
this.initialize();
}
this.initialized = true;
},
beforeUnmount() {
window.removeEventListener("resize", this.updateWindowSize);
@ -212,7 +213,7 @@ export default {
const first = this.visibleDates.find((d) => d.isAvailable);
this.$emit("update:modelValue", first ? first.value : null);
},
initializeWindow() {
initialize() {
this.initialized = true;
if (this.modelValue !== null) return;