mirror of
https://github.com/nasa/openmct.git
synced 2025-06-22 17:08:57 +00:00
Transaction fix (#4421)
* When transaction is active, objects.get should search in dirty object first. Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
@ -184,6 +184,15 @@ ObjectAPI.prototype.get = function (identifier, abortSignal) {
|
||||
}
|
||||
|
||||
identifier = utils.parseKeyString(identifier);
|
||||
let dirtyObject;
|
||||
if (this.isTransactionActive()) {
|
||||
dirtyObject = this.transaction.getDirtyObject(keystring);
|
||||
}
|
||||
|
||||
if (dirtyObject) {
|
||||
return Promise.resolve(dirtyObject);
|
||||
}
|
||||
|
||||
const provider = this.getProvider(identifier);
|
||||
|
||||
if (!provider) {
|
||||
|
@ -55,6 +55,17 @@ export default class Transaction {
|
||||
});
|
||||
}
|
||||
|
||||
getDirtyObject(keystring) {
|
||||
let dirtyObject;
|
||||
this.dirtyObjects.forEach(object => {
|
||||
if (this.objectAPI.makeKeyString(object.identifier) === keystring) {
|
||||
dirtyObject = object;
|
||||
}
|
||||
});
|
||||
|
||||
return dirtyObject;
|
||||
}
|
||||
|
||||
start() {
|
||||
this.dirtyObjects = new Set();
|
||||
}
|
||||
|
Reference in New Issue
Block a user