-
Notifications
You must be signed in to change notification settings - Fork 228
Description
Describe the bug
Element's instanceKeyCache is not properly cleared when updating an element's code value. This bug was found in an imodel-transformer test and can be replicated with this test below added to IModel.test.ts. Note a better/simpler test should be written since this was specific to transforming elements. Just updating one element's code should suffice.
To Reproduce
it.only("should successfully process changes when Definition Elements' codeValues are switched around", async () => {
const dbFileName = IModelTestUtils.prepareOutputFile("IModel", "change-codeValues.bim");
const imodelDb = SnapshotDb.createEmpty(dbFileName, {
rootSubject: { name: "change-codeValues" },
});
let categoryA = SpatialCategory.create(
imodelDb,
IModel.dictionaryId,
"A"
);
let categoryB = SpatialCategory.create(
imodelDb,
IModel.dictionaryId,
"B"
);
categoryA.userLabel = "A";
categoryB.userLabel = "B";
categoryA.insert();
categoryB.insert();
imodelDb.saveChanges();
categoryA = imodelDb.elements.getElement(
SpatialCategory.createCode(imodelDb, IModel.dictionaryId, "A")
);
categoryB = imodelDb.elements.getElement(
SpatialCategory.createCode(imodelDb, IModel.dictionaryId, "B")
);
categoryA.code.value = "temp";
categoryA.update();
categoryB.code.value = "A";
categoryB.update();
categoryA.code.value = "B";
categoryA.update();
imodelDb.saveChanges();
categoryA = imodelDb.elements.getElement(
SpatialCategory.createCode(imodelDb, IModel.dictionaryId, "A")
);
categoryB = imodelDb.elements.getElement(
SpatialCategory.createCode(imodelDb, IModel.dictionaryId, "B")
);
Expected behavior
userLabel of category should properly update, and element cached results should be cleared during update
-->
Metadata
Metadata
Assignees
Labels
No labels