Skip to content

Keep the published cache current after content type imports before Umbraco 17.7 - #1102

Merged
KevinJump merged 1 commit into
v17/mainfrom
fix/umbraco-17.7-cache-workarounds
Sep 30, 2026
Merged

KevinJump merged 1 commit into
v17/mainfrom
fix/umbraco-17.7-cache-workarounds

Conversation

@KevinJump

Copy link
Copy Markdown
Owner

Follows up the "Also reviewed" table in #1067. Umbraco 17.7 fixes two core bugs that leave the published cache stale after a uSync content type import on 17.3–17.6. This works around both. All tests pass on 17.3.0 and 17.7.0 (176 of 176).

Changes

Compositions (umbraco/Umbraco-CMS#23433). On 17.3, adding a composition to a doctype only refreshes the cache for that doctype. Its children keep a published content type without the new properties until a restart. SaveItemAsync now notes whether the compositions changed, and if so refreshes the types built from the doctype (GetComposedOf). This is a normal refresh that clears their published types without rebuilding content, so it costs little on 17.7, where Umbraco already does this.

Property variance (umbraco/Umbraco-CMS#23445). A content type that comes back out of the cache keeps its property types' dirty state from when they were created. A change to only a property's variance then isn't treated as structural, and published content keeps serving the old values. A new FindOrCreateAsync override clears that state on an existing content type as soon as it's loaded, which 17.7 now does itself. This covers document, media and member types.

DistributedCache comes from StaticServiceProvider, so the serializer constructors don't change.

Tests

ContentTypeCacheRefreshTests imports through the serializer, with and without a real runtime cache, and checks what the site serves. On 17.3 without the workarounds the composition test fails in both cache modes and the variance test in the real-cache one. With the workarounds all four pass, on 17.3 and on 17.7.

Refs #1067

🤖 Generated with Claude Code

…braco 17.7

Two core bugs, fixed in 17.7, leave the published cache stale after a
uSync content type import on 17.3-17.6:

- Adding a composition only refreshed the type itself, so its children
  kept a published type without the new properties
  (umbraco/Umbraco-CMS#23433). After saving a composition change we now
  refresh the types composed of it.
- A content type loaded from the cache kept its property types' dirty
  state from creation, so a variance-only change was not treated as
  structural (umbraco/Umbraco-CMS#23445). We now clear that state when
  the item is loaded for import.

Both are harmless on 17.7. DistributedCache comes from
StaticServiceProvider so the serializer constructors don't change.

Refs #1067

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.

1 participant