Skip to content

Conversation

@NeilRashbrook
Copy link
Collaborator

  • Changing the frequency to None wasn't collapsing the repeat box
  • Even when it does, sometimes updateDateUI runs first; in this case we don't want the update, as the rule would be invalid
  • Even when updateDateUI is supposed to run, the rule may already be valid, so don't update it, as that will regenerate the instances
  • When first editing the event, don't bother generating the instances on the unedited copy, instead just shallow clone them

@NeilRashbrook NeilRashbrook self-assigned this Aug 25, 2025
@benbucksch benbucksch added the performance Speed: It's slower than it should be. label Aug 25, 2025
Copy link
Collaborator

@benbucksch benbucksch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duh, I didn't send off the review.

$: $event.startTime, $event.duration, updateDateUI();
function updateDateUI() {
// This should close the repeat box, but this update might run first.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"This" "this"?

Unclear what the first and second "this" refer to.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry; for the first "this" I was referring to the frequency being None, while the second "this" refers to this function.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Can you please fix the comment?

}
this.timezone ||= myTimezone();
this.unedited = this.calendar.newEvent();
// Use a raw event to avoid automatic instance generation.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does a raw Event not generate instances? It should!

Can you find another way which is more explicit?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A raw event doesn't have a calendar, so we don't bother generating instances. The other way is to explicitly set the calendar to null.

Copy link
Collaborator

@benbucksch benbucksch Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned, a raw Event should generate instances. We may need that for various circumstances in the future. At the very least, please assume that they do.

In general, never rely on assumptions about how other classes, components or other parts of the code are implemented. This leads to fragile code and is a big no-no in Mustang. Each class and component must depend only on the public API of other components, in form of functions and properties, and not on their specific and current implemention behavior. (And this here is nothing you can just document in a code comment, because it will likely change.)

This PR cannot land with this assumption.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other classes

Then it's a good thing I'm making assumptions about how this class is implemented. Also, we already have other events that don't generate instances.

// Use a raw event to avoid automatic instance generation.
this.unedited = new Event();
this.unedited.copyFrom(this);
// Instead, just shallow clone our instances (needed for `seriesStatus`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear how that interacts with all our other recurrence editing and generating and saving code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we shouldn't be saving the unedited version...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what "Instead" refers to? What's the alternative that we intentionally don't do?

@benbucksch benbucksch force-pushed the master branch 3 times, most recently from d2ed3e0 to 3fc49e6 Compare August 30, 2025 02:31
}
this.timezone ||= myTimezone();
this.unedited = this.calendar.newEvent();
// Use a raw event to avoid automatic instance generation.
Copy link
Collaborator

@benbucksch benbucksch Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned, a raw Event should generate instances. We may need that for various circumstances in the future. At the very least, please assume that they do.

In general, never rely on assumptions about how other classes, components or other parts of the code are implemented. This leads to fragile code and is a big no-no in Mustang. Each class and component must depend only on the public API of other components, in form of functions and properties, and not on their specific and current implemention behavior. (And this here is nothing you can just document in a code comment, because it will likely change.)

This PR cannot land with this assumption.

// Use a raw event to avoid automatic instance generation.
this.unedited = new Event();
this.unedited.copyFrom(this);
// Instead, just shallow clone our instances (needed for `seriesStatus`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what "Instead" refers to? What's the alternative that we intentionally don't do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Speed: It's slower than it should be.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants