Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ar(fix) ThunderBird calendar slows after editing one CalDav entry: draft: watch events prop drain #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions src/Qalendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ export default defineComponent({
type: Array as PropType<eventInterface[]>,
default: () => [],
},
updatedEvents: {
type: Array as PropType<eventInterface[]>,
default: () => [],
},
selectedDate: {
type: Date,
default: new Date(),
Expand Down Expand Up @@ -184,30 +188,16 @@ export default defineComponent({
ErrorsHelper: Errors,
};
},
computed:{
computed: {
enhancedConfig(): configInterface {
return { ...this.config, isSmall: this.isSmall }
},
updatedEvents(): PropType<eventInterface[]>{
return { ...this.events }
}
},

watch: {
events: {
deep: true,
handler(newVal, oldVal) {
// The check on strict equality as primitive values is needed,
// since we do not want to trigger a rerender on event-was-resized
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
this.eventsDataProperty = newVal;
this.eventRenderingKey = this.eventRenderingKey + 1;
}

if (this.config.isSilent) return;

this.events.forEach((e) => this.ErrorsHelper.checkEventProperties(e));
},
immediate: true,
},
Comment on lines -194 to -209
Copy link
Author

Choose a reason for hiding this comment

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

This is a drainer.


config: {
deep: true,
handler(value: configInterface) {
Expand Down Expand Up @@ -325,8 +315,12 @@ export default defineComponent({
const newEvents = this.eventsDataProperty.filter(
(e) => e.id !== calendarEvent.id
);

this.eventsDataProperty = [calendarEvent, ...newEvents];
this.$emit(`event-was-${eventType}`, calendarEvent);

if (this.config.isSilent) return;
newEvents.forEach((e) => this.ErrorsHelper.checkEventProperties(e));
},

setTimePointsFromDayBoundary(boundary: number) {
Expand Down