Javascript code to add in a WordPress metabox to trigger the refresh of the metabox content which doesn’t update after Gutenberg saving process.
<script>
const appuntiStatusChange = ( function(){
const isSavingMetaBoxes = wp.data.select( 'core/edit-post' ).isSavingMetaBoxes;
var wasSaving = false;
return {
refreshMetabox: function(){
var isSaving = isSavingMetaBoxes();
if ( wasSaving && ! isSaving ) {
alert("Post changed and saved, call your metabox refresh function here.");
}
wasSaving = isSaving;
},
}
})();
wp.data.subscribe( appuntiStatusChange.refreshMetabox );
</script>