Skip to content

Commit

Permalink
[INTERNAL][FIX] sap.ui.rta: Page variant is not properly applied
Browse files Browse the repository at this point in the history
- Fixes issue with variant changes being deleted from the change persistence when navigating to a different page
- in this scenario now changes are only removed from the variant and dependency map not from the change persistence

SNOW: DINC0239989
Change-Id: I7b9e96186f89119d3ba27e598feadcf0703b6bf2
  • Loading branch information
Michael Zadikowitsch committed Sep 3, 2024
1 parent 426c2d4 commit 4fc5e14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/sap.ui.fl/src/sap/ui/fl/variants/VariantModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1560,8 +1560,10 @@ sap.ui.define([
return mCurrentVariant.controlChanges;
})
.flat();
const oLiveDependencyMap = FlexObjectState.getLiveDependencyMap(this.sFlexReference);
aVariantDependentControlChanges.forEach((oChange) => {
this.oChangePersistence.removeChange(oChange);
DependencyHandler.removeChangeFromMap(oLiveDependencyMap, oChange.getId());
DependencyHandler.removeChangeFromDependencies(oLiveDependencyMap, oChange.getId());
});

this.oDataSelector.removeUpdateListener(this.fnUpdateListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2433,9 +2433,10 @@ sap.ui.define([
});
FlexObjectManager.addDirtyFlexObjects(this.oModel.sFlexReference, [oUIChange]);
this.oModel.destroy();
const oFlexObjects = FlexState.getFlexObjectsDataSelector().get({ reference: sReference });
assert.strictEqual(oFlexObjects[0].getId(), "newUIChange", "then the change was not removed from the flex state");
assert.strictEqual(oAddRuntimeOnlySpy.callCount, 1, "then the fake Standard variant is added to the runtimeOnlyData");

stubFlexObjectsSelector([oUIChange]);
this.oModel = new VariantModel({}, {
flexController: this.oFlexController,
appComponent: this.oComponent
Expand Down

0 comments on commit 4fc5e14

Please sign in to comment.