Fix: move property out of group on import (#1009) - #1010
Conversation
Importing a content type where a property has been moved out of all groups (empty <Tab> and no matching <Tabs> entry) did nothing - the property stayed in its original group. DeserializePropertiesAsync only handled properties moving *into* a tab. When the tab alias resolved to empty for an existing property, the else branch fell through without action. Now, when an existing property has no tab in the config but is still in a group, it is queued to move to "no group" via MovePropertyType(alias, null), which Umbraco treats as removing it from its current group. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…1009) Moving a property out of all groups still needed two imports. Root cause: Umbraco's MovePropertyType(alias, null) removes the property from its group but does NOT add it to the 'no group' collection - it orphans the property, so the first import's save doesn't persist the move. MoveProperties now re-adds the property with AddPropertyType after the move to null, which lands it in NoGroupPropertyTypes. Added unit tests documenting the orphaning behaviour and verifying the workaround. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Follow-up: the first commit made the property move, but it still needed two imports to stick. Traced the root cause: Umbraco's Fix in Added |
* Fix: move property out of group on import (#1009) Importing a content type where a property has been moved out of all groups (empty <Tab> and no matching <Tabs> entry) did nothing - the property stayed in its original group. DeserializePropertiesAsync only handled properties moving *into* a tab. When the tab alias resolved to empty for an existing property, the else branch fell through without action. Now, when an existing property has no tab in the config but is still in a group, it is queued to move to "no group" via MovePropertyType(alias, null), which Umbraco treats as removing it from its current group. * Fix: re-home property into no-group so move persists in one import (#1009) Moving a property out of all groups still needed two imports. Root cause: Umbraco's MovePropertyType(alias, null) removes the property from its group but does NOT add it to the 'no group' collection - it orphans the property, so the first import's save doesn't persist the move. MoveProperties now re-adds the property with AddPropertyType after the move to null, which lands it in NoGroupPropertyTypes. Added unit tests documenting the orphaning behaviour and verifying the workaround. --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Fixes #1009
What changed
DeserializePropertiesAsyncinContentTypeBaseSerializernow handles a property being moved out of all groups during import.Why
When a content type's
.configis edited so a property has an empty<Tab></Tab>and is removed from<Tabs>, importing did nothing — the property stayed in its original group. Bulk imports appeared to no-op; single-item imports appeared to "revert".The deserialize loop only handled properties moving into a tab. For an existing property whose tab alias resolved to an empty string, the
elsebranch fell through without taking any action, so the property was never removed from its old group.How
propertiesToMoveis nowDictionary<string, string?>, where anulltarget means "no group".elsebranch: when an existing property has no tab in the config but is still assigned to a group, it is queued to move to no-group.MovePropertiespasses the value toitem.MovePropertyType(alias, null).MovePropertyType(alias, null)was verified againstUmbraco.Core17.5.3 — anullgroup alias removes the property from its current group and setsPropertyGroupId = null, landing it inNoGroupPropertyTypes, which is the intended result. The change is reported with(No group)as the destination.Notes for reviewer
uSync.Core), no new warnings. TheIContentTypeBaseinterface declares the group-alias param non-nullable while the implementation accepts null, so the call uses the null-forgiving operator.uSync.Testshas no content-type serializer harness (that requires a full Umbraco service context).🤖 Generated with Claude Code