Skip to content
Snippets Groups Projects
Commit eeabf590 authored by permcu's avatar permcu
Browse files

Remove render loop caused by docsByDay

-> no more docsByDay state in component
parent d9e768d1
No related branches found
No related tags found
No related merge requests found
......@@ -231,7 +231,7 @@ export default {
},
groupDocsByDay(docs) {
// => {dt: [dt doc ...] ...}
this.docsByDay = docs.reduce((byDay, doc) => {
const docsByDay = docs.reduce((byDay, doc) => {
// This works with dummy. Does actual doc have dateStart instead?
const day = DateTime.fromISO(doc.datetimeStart).startOf("day");
byDay[day] ??= [day];
......@@ -239,9 +239,9 @@ export default {
return byDay;
}, {});
// => [[dt doc ...] ...]
return Object.keys(this.docsByDay)
return Object.keys(docsByDay)
.sort()
.map((key) => this.docsByDay[key]);
.map((key) => docsByDay[key]);
// sorting is necessary since backend can send docs unordered
},
debounce(fn, delay) {
......@@ -348,9 +348,10 @@ export default {
if (!this.knownDates[date]) {
console.log(this.lastQuery);
console.log('unknown date', date.toISODate());
console.log(this.knownDates);
// find missing & fetch missing range
const missing = this.dateRange(date)
.filter((ts) => !this.docsByDay[ts]);
.filter((ts) => !this.knownDates[ts]);
// ask for first to last
this.lastQuery.fetchMore({
variables: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment