Skip to content

Fixes save of empty, invariant block list on variant content #18932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ private void MapBlockItemDataFromEditor(List<BlockItemData> items)

TValue? mergedBlockValue =
MergeVariantInvariantPropertyValueTyped(source, target, canUpdateInvariantData, allowedCultures);
if (mergedBlockValue is null)
{
return null;
}

return _jsonSerializer.Serialize(mergedBlockValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ public void Validates_Number_Of_Items_Is_Less_Than_Or_Equal_To_Configured_Max(in
}
}

[Test]
public void MergeVariantInvariantPropertyValue_Can_Merge_Null_Values()
{
var editor = CreateValueEditor();
var result = editor.MergeVariantInvariantPropertyValue(null, null, true, ["en-US"]);
Assert.IsNull(result);
}

private static JsonObject CreateBlocksJson(int numberOfBlocks)
{
var layoutItems = new JsonArray();
Expand Down