Skip to content

Fix #800 Add blockItemConverters #801

Merged
KevinJump merged 4 commits into
v16/mainfrom
v16/BlockItemConverters
Sep 16, 2025
Merged

Fix #800 Add blockItemConverters #801
KevinJump merged 4 commits into
v16/mainfrom
v16/BlockItemConverters

Conversation

@KevinJump

Copy link
Copy Markdown
Owner

In v16 the BlockLayoutItem classes 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 BlockListLayoutItem and BlockGridLayoutItem, 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.

@KevinJump KevinJump requested a review from Copilot September 15, 2025 16:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread uSync.Core/Json/JsonBlockItemConverters.cs Outdated
Comment thread uSync.Core/Json/JsonBlockItemConverters.cs Outdated
Comment thread uSync.Core/Json/JsonBlockItemConverters.cs Outdated
Comment thread uSync.Core/Json/JsonBlockItemConverters.cs Outdated
Comment thread uSync.Core/Json/XElementJsonConverter.cs Outdated
@KevinJump KevinJump requested a review from Copilot September 15, 2025 16:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread uSync.Core/Json/JsonBlockItemConverters.cs Outdated
Comment on lines +60 to +61
// 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.

Copilot AI Sep 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'.

Suggested change
// 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.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@KevinJump KevinJump merged commit 15add2e into v16/main Sep 16, 2025
1 check passed
@KevinJump KevinJump deleted the v16/BlockItemConverters branch September 16, 2025 10:40
alexsee pushed a commit to alexsee/umbraco-container that referenced this pull request Sep 28, 2025
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>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=uSync&package-manager=nuget&previous-version=16.0.4&new-version=16.0.5)](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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants