Skip to content

Commit

Permalink
Make sure to save null for removed optional object
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoshino committed Jul 3, 2024
1 parent 64f32e1 commit 2d8f00c
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
* Remove the object’s subfields from the entry draft.
*/
const removeFields = () => {
$i18nAutoDupEnabled = false;
Object.entries($entryDraft?.currentValues ?? {}).forEach(([_locale, _valueMap]) => {
if (_locale === locale || i18n === 'duplicate') {
Object.keys(_valueMap).forEach((_keyPath) => {
Expand All @@ -161,12 +163,12 @@
}
});
if (required) {
// Enable validation
/** @type {EntryDraft} */ ($entryDraft).currentValues[_locale][keyPath] = null;
}
// Enable validation
/** @type {EntryDraft} */ ($entryDraft).currentValues[_locale][keyPath] = null;
}
});
$i18nAutoDupEnabled = true;
};
/**
Expand Down

0 comments on commit 2d8f00c

Please sign in to comment.