Fix create missing checkbox not persisting (#4008)

This commit is contained in:
WithoutPants
2023-08-08 11:00:20 +10:00
committed by GitHub
parent 030bc5d7c1
commit ed9f35a973

View File

@@ -190,19 +190,24 @@ const FieldOptionsEditor: React.FC<IFieldOptionsEditor> = ({
return; return;
} }
const localOptionsCopy = { ...localOptions };
if (localOptionsCopy.strategy === undefined && !allowSetDefault) {
localOptionsCopy.strategy = GQL.IdentifyFieldStrategy.Merge;
}
// send null if strategy is undefined // send null if strategy is undefined
if (localOptions.strategy === undefined) { if (localOptionsCopy.strategy === undefined) {
editOptions(null); editOptions(null);
resetOptions(); resetOptions();
} else { } else {
let { createMissing } = localOptions; let { createMissing } = localOptionsCopy;
if (createMissing === undefined && !allowSetDefault) { if (createMissing === undefined && !allowSetDefault) {
createMissing = false; createMissing = false;
} }
editOptions({ editOptions({
...localOptions, ...localOptionsCopy,
strategy: localOptions.strategy, strategy: localOptionsCopy.strategy,
createMissing, createMissing,
}); });
} }