sap.m.p13n.FilterController: filter dialog receives frozen conditions, editing an applied filter throws "Cannot assign to read only property"
What is the issue and how can we reproduce it?
- Open the
sap.m.p13n.Enginesample: https://sdk.openui5.org/test-resources/sap/m/demokit/sample/p13n/Engine/index.html (Demo Kit entry: https://sdk.openui5.org/#/entity/sap.m.p13n.Engine/sample/sap.m.sample.p13n.Engine) - Press the Settings button (gear icon) in the table toolbar and switch to the Filter tab.
- Select e.g. First Name, type
Peterinto its input and press OK — the filter is applied and persisted into the table'sxConfigcustom data. - Press Settings again, switch to the Filter tab (the condition from step 3 is shown) and change the value of the input of that existing condition and try to apply the filter → Issue: the input does not accept the change and the console shows a
TypeErrorand the new filter input is not applied on the table.
This issue was found after upgrading from 1.136 to 1.148 and also is affecting SAP UI5 1.148.
Error:
Uncaught TypeError: Cannot assign to read only property '0' of object '[object Array]'
Expected behavior:
An already applied filter condition can be edited in the filter dialog, exactly as in 1.148.10 and earlier.
Analysis powered by Claude:
The regression was introduced in sap/m/p13n/modules/xConfigAPI.js between 1.148.0 and 1.148.1.
Up to 1.148.0, both the sync and async paths of xConfigAPI.readConfig returned a fresh mutable copy:
const oConfig = oAggregationConfig
? merge({}, JSON.parse(fnGetPropertySync(oAggregationConfig, "value").replace(/\\/g, '')))
: null;
return oConfig;
As of 1.148.1, the parse result is cached per xConfig custom data element in a WeakMap and deep frozen:
let oParsed = oParsedXConfigCache.get(oAggregationConfig);
if (!oParsed) {
oParsed = deepFreezeJSON(JSON.parse(fnGetPropertySync(oAggregationConfig, "value").replace(/\\/g, '')));
oParsedXConfigCache.set(oAggregationConfig, oParsed);
}
return oParsed;
FilterController#getCurrentState passes those frozen condition objects straight through, without copying:
FilterController.prototype.getCurrentState = function () {
const oXConfig = xConfigAPI.readConfig(this.getAdaptationControl()) || {};
const aConditions = oXConfig.hasOwnProperty("properties") ? oXConfig.properties.filterConditions : [];
return aConditions?.reduce((mConditions, oState) => {
const sKey = oState.key;
mConditions[sKey] = mConditions[sKey] || [];
mConditions[sKey].push(oState.condition); // <-- frozen object from the cached parse
return mConditions;
}, {}) || {};
};
and FilterController#mixInfoAndState puts them into the adaptation data as-is:
const aExistingFilters = mExistingFilters[mItem.name];
mItem.conditions = aExistingFilters || (...);
That data becomes the $p13n model of the FilterPanel, whose (default) input is bound two-way to {$p13n>conditions/0/values/0}. Writing the user's input into the frozen values array throws the TypeError above, so any condition that was already applied can no longer be changed.
Engine#retrieveState is not affected, because it copies the state via merge({}, oRetrievedState) before returning it.
Which OpenUI5 version is your project targeting?
1.148.8
Is the issue device- or browser-specific?
No response
Confirmation
- [x] I have searched the existing issues and reviewed the relevant documentation as well as the API reference.
- [x] I am not disclosing any internal or sensitive information.
Hello @konstantin-roehm ,
Thank you for sharing this finding. I've created an internal incident DINC1049234. The status of the issue will be updated here in GitHub.
Regards, Petar
Thank you for reporting this issue and for the thorough analysis, it really helped us resolve it faster. The fix will be included in the next release, along with patch releases for 1.151 and 1.148.