Fix #800 Add blockItemConverters #801
Conversation
…roperties even when they change
There was a problem hiding this comment.
Pull Request Overview
This PR addresses issue #800 by adding custom JSON converters to handle obsolete properties in BlockLayoutItem classes that were causing false positives during import detection. The converters ensure consistent serialization by always writing obsolete properties (ContentUdi, SettingsUdi) as null.
- Adds custom JSON converters for BlockListLayoutItem and BlockGridLayoutItem
- Ensures consistent serialization of obsolete properties to prevent false change detection
- Registers the new converters in the default JSON serialization options
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| uSync.Core/Json/XElementJsonConverter.cs | Adds import for Umbraco.Cms.Core.Models.Blocks namespace |
| uSync.Core/Json/JsonBlockItemConverters.cs | Implements custom JSON converters for block layout items |
| uSync.Core/Extensions/JsonTextExtensions.cs | Registers the new converters in serialization options |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // we could just not write out the obsolete properties, but they will appear as null it | ||
| // lots of people's existing exports , so we can write them out as null to keep things consistent. |
There was a problem hiding this comment.
The comment has a grammatical error. 'but they will appear as null it lots of people's existing exports' should be 'but they will appear as null in lots of people's existing exports'.
| // we could just not write out the obsolete properties, but they will appear as null it | |
| // lots of people's existing exports , so we can write them out as null to keep things consistent. | |
| // we could just not write out the obsolete properties, but they will appear as null in | |
| // lots of people's existing exports, so we can write them out as null to keep things consistent. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Updated [uSync](https://github.com/KevinJump/uSync) from 16.0.4 to 16.0.5. <details> <summary>Release notes</summary> _Sourced from [uSync's releases](https://github.com/KevinJump/uSync/releases)._ ## 16.0.5 This is a patch release for uSync v16 for Umbraco v16 - it contains some fixes to reported issues. ## What's Changed * add missing translations for summary (over 1000) titles in report das… by @KevinJump in KevinJump/uSync#796 * add waiting state to the import upload button. by @KevinJump in KevinJump/uSync#797 * Fix #800 Add blockItemConverters by @KevinJump in KevinJump/uSync#801 * V16/new trash handling by @KevinJump in KevinJump/uSync#802 * Fix - topological sort, - key not matching internally. by @KevinJump in KevinJump/uSync#803 **Full Changelog**: KevinJump/uSync@v16.0.4...v16.0.5 Commits viewable in [compare view](KevinJump/uSync@v16.0.4...v16.0.5). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
In v16 the
BlockLayoutItemclasses have two obsolete properties (ContentUdi, SettingsUdi) these are often null, but sometimes not, depending on how you have asked for the content item.these being set sometimes can cause us to think the content property has changed, when it hasn't so we get false positives, and things import when they don't need to import.
adding our own custom JsonConverters for
BlockListLayoutItemandBlockGridLayoutItem, means we can control exactly how these elements are handled in the json.these converters always write the old values out as null, (as they are not used). and this way they are consitant, and also appear as they are most likely to appear in existing imports.
for v18 we will remove them so only the keys get written out.