I think the problem might be that the spread operator is missing in a couple of places. This line:
return {
meta: { currentMeta, editedMeta },
};
in withSelect
should be:
return {
meta: { ...currentMeta, ...editedMeta },
};
This makes the meta
object be a copy of currentMeta
(have all the same properties and values), but overwrites them with any that are present in editedMeta
.
There is a mixture of ES5 and ES6 syntax in the code, so if that doesn’t work you can achieve the same thing with ES5 by doing:
return {
meta: Object.assign( {}, currentMeta, editedMeta ),
};
Also in withDispatch
the same technique is being used to update the meta
object, so that will need changing to:
updateDisableFeaturedImage( value, meta ) {
meta = {
...meta,
disable_featured_image: value,
};
I’ve not tested this so there might be other problems, but hopefully, this will get you a step closer. Good luck!