Closed Bug 1585230 Opened 6 months ago Closed 6 months ago

Don't add agenda items while in a batch, only to refresh the view at the end of the batch

Categories

(Calendar :: Calendar Views, enhancement)

enhancement
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: darktrojan, Assigned: darktrojan)

References

(Regressed 1 open bug)

Details

(Keywords: perf)

Attachments

(1 file)

As a calendar loads, we add every valid item to the agenda, then once the load is complete, we throw them all away and reload the agenda. This is a big waste of time.

Attachment #9097561 - Flags: review?(paul)
Comment on attachment 9097561 [details] [diff] [review]
1585230-agenda-batch-items-1.diff

Review of attachment 9097561 [details] [diff] [review]:
-----------------------------------------------------------------

::: calendar/base/content/agenda-listbox-utils.js
@@ +879,5 @@
>  
>  agendaListbox.calendarObserver.onEndBatch = function() {};
>  
>  agendaListbox.calendarObserver.onLoad = function() {
> +  this.isInBatch = false;

Hmm, should `isInBatch` be set to false in the `onEndBatch` function just above?  Maybe only there and not here?  Or if I'm missing something, maybe a comment to explain why it's being set to false in `onLoad`?
Attachment #9097561 - Flags: review?(paul)

There can be more than one batch. onLoad happens after all of them. Maybe I should use a better variable name, it's just what I thought of at the time.

Comment on attachment 9097561 [details] [diff] [review]
1585230-agenda-batch-items-1.diff

Review of attachment 9097561 [details] [diff] [review]:
-----------------------------------------------------------------

Ah, okay.  Yeah, maybe `this.isInBatches` or a comment or something to make things a bit clearer.  Or... another option (maybe overkill): `this.currentBatchCount` that's incremented/decremented in onStartBatch/onEndBatch.  Feel free to address as you like.
Attachment #9097561 - Flags: review+

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/58d372a30be2
Don't add agenda items while in a batch, only to refresh the view at the end of the batch; r=pmorris

Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 71
Regressions: 1623276
You need to log in before you can comment on or make changes to this bug.