@forcecalendar/interface 1.0.31 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5176,14 +5176,22 @@ class ie {
|
|
|
5176
5176
|
}
|
|
5177
5177
|
/**
|
|
5178
5178
|
* Sync state.events from Core calendar (single source of truth)
|
|
5179
|
-
* This ensures state.events always matches Core's event store
|
|
5179
|
+
* This ensures state.events always matches Core's event store.
|
|
5180
|
+
*
|
|
5181
|
+
* @param {object} options
|
|
5182
|
+
* @param {boolean} options.silent - suppress subscriber notifications
|
|
5183
|
+
* @param {boolean} options.force - always update even when IDs match
|
|
5184
|
+
* (required after updateEvent where IDs
|
|
5185
|
+
* are unchanged but content has changed)
|
|
5180
5186
|
*/
|
|
5181
5187
|
_syncEventsFromCore(e = {}) {
|
|
5182
|
-
const t = this.calendar.getEvents() || [];
|
|
5183
|
-
return (this.state.events.length !==
|
|
5188
|
+
const { force: t = !1 } = e, s = this.calendar.getEvents() || [];
|
|
5189
|
+
return (t || this.state.events.length !== s.length || !this._eventsMatch(this.state.events, s)) && this.setState({ events: [...s] }, e), s;
|
|
5184
5190
|
}
|
|
5185
5191
|
/**
|
|
5186
|
-
* Check if two event arrays have the same events
|
|
5192
|
+
* Check if two event arrays have the same events by id.
|
|
5193
|
+
* Only used for add/delete guards — updateEvent must pass force:true
|
|
5194
|
+
* to bypass this check because IDs are unchanged after an update.
|
|
5187
5195
|
*/
|
|
5188
5196
|
_eventsMatch(e, t) {
|
|
5189
5197
|
if (e.length !== t.length) return !1;
|
|
@@ -5276,7 +5284,7 @@ class ie {
|
|
|
5276
5284
|
updateEvent(e, t) {
|
|
5277
5285
|
this._syncEventsFromCore({ silent: !0 });
|
|
5278
5286
|
const s = this.calendar.updateEvent(e, t);
|
|
5279
|
-
return s ? (this._syncEventsFromCore(), u.emit("event:update", { event: s }), u.emit("event:updated", { event: s }), s) : (console.error(`Failed to update event: ${e}`), u.emit("event:error", {
|
|
5287
|
+
return s ? (this._syncEventsFromCore({ force: !0 }), u.emit("event:update", { event: s }), u.emit("event:updated", { event: s }), s) : (console.error(`Failed to update event: ${e}`), u.emit("event:error", {
|
|
5280
5288
|
action: "update",
|
|
5281
5289
|
eventId: e,
|
|
5282
5290
|
updates: t,
|