Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-09 20:02:54 +01:00
FIX: add observed cache to undo changes mixin
Prevents observer add / remove race conditions which can cause exceptions.
Dieser Commit ist enthalten in:
Ursprung
030929a414
Commit
0e70a5a221
5 geänderte Dateien mit 13 neuen und 5 gelöschten Zeilen
|
@ -4,6 +4,8 @@ import { get, set } from "@ember/object";
|
|||
import Mixin from "@ember/object/mixin";
|
||||
import { deepEqual } from "discourse-common/lib/object";
|
||||
|
||||
var observedCache = [];
|
||||
|
||||
export default Mixin.create({
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
|
@ -32,7 +34,10 @@ export default Mixin.create({
|
|||
};
|
||||
|
||||
listProperties(componentType, opts).forEach((property) => {
|
||||
obj.removeObserver(property, this, this.toggleUndo);
|
||||
if (observedCache.includes(property)) {
|
||||
obj.removeObserver(property, this, this.toggleUndo);
|
||||
observedCache = observedCache.filter(p => p !== property);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -45,6 +50,9 @@ export default Mixin.create({
|
|||
};
|
||||
|
||||
listProperties(componentType, opts).forEach((property) => {
|
||||
if (observedCache.indexOf(property) === -1) {
|
||||
observedCache.push(property);
|
||||
}
|
||||
obj.addObserver(property, this, this.toggleUndo);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
# name: discourse-custom-wizard
|
||||
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
||||
# version: 2.2.6
|
||||
# version: 2.2.7
|
||||
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever
|
||||
# url: https://github.com/paviliondev/discourse-custom-wizard
|
||||
# contact_emails: development@pavilion.tech
|
||||
|
|
Laden …
In neuem Issue referenzieren