Update component

I’m submitting a…

  • [ v] Bug report

Current behavior

I have a Update script which tries to update localized component script field, but it looks like it doesn’t work.
Here’s a script: parts is a localized component field.

for(var lng of Object.keys(ctx.data.parts)){
    for(var i in ctx.data.parts[lng]){
        ctx.data.parts[lng][i]["media-type"] = "image";
        ctx.data.debug.iv = JSON.stringify(ctx.data.parts[lng][i]);
    }
}
replace();

I see that in debug json field, there’s a field ‘media-type’ with ‘image’ value, but real record doesn’t have this field filled.
Same thing happens in Query script.

Environment

  • [ v] Self hosted with docker

Version: 7.15.0

Nested changes are not detected. You have to construct a new object and assign the media type there…similar to your iv field.