@sprucelabs/spruce-calendar-components 26.0.13 → 26.0.14

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.
@@ -228,13 +228,16 @@ class CalendarEventManager {
228
228
  var _a;
229
229
  this.isRunningUpdateQueue = true;
230
230
  let next;
231
- let lastEvent;
231
+ const savedEvents = [];
232
232
  while ((next = this.updateOperations.shift())) {
233
- lastEvent = await next.execute();
234
- }
235
- if (!this.hasPendingContextChanges &&
236
- ((_a = this.sm.getContext().event) === null || _a === void 0 ? void 0 : _a.id) === (lastEvent === null || lastEvent === void 0 ? void 0 : lastEvent.id)) {
237
- await this.updateEventInContext(lastEvent);
233
+ const e = await next.execute();
234
+ savedEvents.push(e);
235
+ }
236
+ const currentId = (_a = this.sm.getContext().event) === null || _a === void 0 ? void 0 : _a.id;
237
+ savedEvents.reverse();
238
+ const eventMatching = savedEvents.find((e) => e.id === currentId);
239
+ if (!this.hasPendingContextChanges && currentId === (eventMatching === null || eventMatching === void 0 ? void 0 : eventMatching.id)) {
240
+ await this.updateEventInContext(eventMatching);
238
241
  }
239
242
  this.isRunningUpdateQueue = false;
240
243
  }
@@ -255,13 +255,16 @@ export default class CalendarEventManager {
255
255
  return __awaiter(this, void 0, void 0, function* () {
256
256
  this.isRunningUpdateQueue = true;
257
257
  let next;
258
- let lastEvent;
258
+ const savedEvents = [];
259
259
  while ((next = this.updateOperations.shift())) {
260
- lastEvent = yield next.execute();
260
+ const e = yield next.execute();
261
+ savedEvents.push(e);
261
262
  }
262
- if (!this.hasPendingContextChanges &&
263
- ((_a = this.sm.getContext().event) === null || _a === void 0 ? void 0 : _a.id) === (lastEvent === null || lastEvent === void 0 ? void 0 : lastEvent.id)) {
264
- yield this.updateEventInContext(lastEvent);
263
+ const currentId = (_a = this.sm.getContext().event) === null || _a === void 0 ? void 0 : _a.id;
264
+ savedEvents.reverse();
265
+ const eventMatching = savedEvents.find((e) => e.id === currentId);
266
+ if (!this.hasPendingContextChanges && currentId === (eventMatching === null || eventMatching === void 0 ? void 0 : eventMatching.id)) {
267
+ yield this.updateEventInContext(eventMatching);
265
268
  }
266
269
  this.isRunningUpdateQueue = false;
267
270
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-calendar-components",
3
3
  "description": "Calendar components for working with calendars and Sprucebot.",
4
- "version": "26.0.13",
4
+ "version": "26.0.14",
5
5
  "skill": {
6
6
  "namespace": "calendar"
7
7
  },