Hi,
In case you are still looking for a solution/workaround, this snippet will watch changes in a layerView filter and will re-add the old value if the new value is null. It should work in the same way with layers and definitionExpressions.
reactiveUtils.watch(
// getValue function
() => layerView.filter?.where,
// Callback function
(newValue, oldValue) => {
console.log('Old value: ', oldValue, 'New value: ', newValue);
if (!newValue && oldValue) {
layerView.filter = {
where: oldValue
};
}
},
// Optional parameters
{
initial: true
}
);