From da7b6bb1d3fc83643b81843496a33005eb9ee6ad Mon Sep 17 00:00:00 2001 From: Michael Bauer <michael-bauer@posteo.de> Date: Fri, 12 Apr 2024 21:29:05 +0200 Subject: [PATCH] Transition from intial query to infinite scroll --- .../frontend/components/coursebook/Coursebook.vue | 9 ++++++--- .../frontend/components/coursebook/CoursebookDay.vue | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue b/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue index 7e017c7a9..92cdf2cf4 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue @@ -69,7 +69,8 @@ :date="date" :docs="docs" :lastQuery="lastQuery" - :focus-on-mount="gotoDate.toMillis() === date.toMillis()" + :focus-on-mount="gotoDate && (gotoDate.toMillis() === date.toMillis())" + @init="transition" /> <date-select-footer :value="$route.hash.substring(1)" /> @@ -142,10 +143,8 @@ export default { groups: [], courses: [], incomplete: false, - // TODO: Start with false until main query finished ready: false, gotoDate: false, - // TODO: Who sets ready true & gotoDate false? }; }, apollo: { @@ -220,6 +219,10 @@ export default { this.resetDate(); // might skip query until both set = atomic }, + transition() { + this.gotoDate = false + this.ready = true + }, groupDocsByDay(docs) { // => {dt: {date: dt, docs: doc ...} ...} const docsByDay = docs.reduce((byDay, doc) => { diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookDay.vue b/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookDay.vue index 4c6171c81..96f3d2dd3 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookDay.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookDay.vue @@ -49,6 +49,7 @@ export default { default: false, }, }, + emits: ['init'], methods: { focus(how) { this.$el.scrollIntoView({ @@ -63,6 +64,7 @@ export default { if (this.focusOnMount) { this.$nextTick(this.focus("instant")); console.log('focused @', this.date.toISODate()); + this.$emit('init'); } }, }; -- GitLab