Conversation
…migration. Refreshes internal datatype cache following migration requiring cache rebuild.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses two critical issues encountered during Umbraco 13 to 16+ migrations: preserving rich text blocks created with TinyMCE and ensuring internal datatype caches are properly refreshed after migrations.
Key Changes:
- Extended
RichTextBlockValueto recognize the legacy"Umbraco.TinyMCE"property editor alias alongside the current"Umbraco.RichText"alias, preventing data loss during theConvertLocalLinksmigration - Added
ClearDataTypeCache()method toIPublishedContentTypeFactoryand its implementation to clear internal datatype caches post-migration - Updated
MigrationPlanExecutorto call the new cache clearing method after rebuilding caches
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Umbraco.Core/Models/Blocks/RichTextBlockValue.cs | Overrides SupportsBlockLayoutAlias() to accept both "Umbraco.RichText" and "Umbraco.TinyMCE" aliases for backward compatibility |
| src/Umbraco.Core/Models/PublishedContent/IPublishedContentTypeFactory.cs | Adds ClearDataTypeCache() method with default no-op implementation to avoid breaking existing mock implementations |
| src/Umbraco.Core/Models/PublishedContent/PublishedContentTypeFactory.cs | Implements ClearDataTypeCache() with proper thread-safety using the existing lock mechanism |
| src/Umbraco.Infrastructure/Migrations/MigrationPlanExecutor.cs | Adds obsolete constructor that chains to new constructor using StaticServiceProvider, adds new constructor parameter for IPublishedContentTypeFactory, and calls ClearDataTypeCache() during cache rebuild |
| tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/RichTextPropertyEditorHelperTests.cs | Parameterizes test to verify parsing works with both "Umbraco.RichText" and "Umbraco.TinyMCE" property editor aliases |
| tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/MigrationPlanTests.cs | Updates test to provide mocked IPublishedContentTypeFactory to new constructor |
| tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Migrations/AdvancedMigrationTests.cs | Updates integration test to provide real IPublishedContentTypeFactory instance to new constructor |
AndyButland
added a commit
that referenced
this pull request
Nov 19, 2025
…local links migration and refreshes internal datatype cache following migration requiring cache rebuild (closes #20885) (#20887) Handles rich text blocks created with TinyMCE in convert local links migration. Refreshes internal datatype cache following migration requiring cache rebuild. # Conflicts: # src/Umbraco.Infrastructure/Migrations/MigrationPlanExecutor.cs
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
Addresses: #20885
Description
This PR contains two updates to address issues found in testing the database provided illustrating the problem encountered in the linked issue.
The most important is the report of block data from blocks in the RTE being removed after the upgrade. I tracked this down to the
ConvertLocalLinksmigration, which requires serializing the rich text content. As in the 13 the layout values key is"Umbraco.TinyMCE"rather than"Umbraco.RichText", these are omitted, and an empty block value is returned. I've resolved that by supporting this key as well, such that the existing values will be read.The second fix is that I noticed that after the migration, when accessing certain content, an error of being unable to find a data type by Id is thrown. This was referring to one of the data types added in a migration - the "Label (pixels)" one. Although we clear caches after the migration completes, there's an internal cache of datatypes in
PublishedContentTypeFactorythat isn't cleared. So I've added a means of doing that and executed it along with the other post-migration cache invalidations.Point to note
In testing this I've also seen that the markup will get encoded via this
ConvertLocalLinksmigration, so starting from:We end up with:
It doesn't seem to cause any issues, but wanted to flag in case this jumps out as a concern.
Testing
I've been working with a customer database that I could share, but I would expect this would be an issue you could see if you follow these steps:
mainorrelease/16.4and I'd expect you would see the block information lost after Umbraco starts and the migration completes.