Skip to content

Conversation

kjac
Copy link
Contributor

@kjac kjac commented Nov 16, 2023

Prerequisites

  • I have added steps to test this contribution in the description below

Description

Whenever one makes changes to a data type, these changes are immediately available in the published properties that are based on this data type. That is, until a piece of content with a property based on this data type is either saved or published; then the data type data is rolled back to the previous version on all published properties of all content using this data type.

This can be reproduced by printing out the max allowed chars on a text string configuration:

  1. Render the page after a restart - the rendered configuration value is (obviously) correct.
  2. Change the configuration value and re-render the page - the rendered configuration value is the updated value (correct).
  3. Save (or publish) a piece of content using this text string configuration and re-render the page - the rendered configuration value is the previously configured value (incorrect)

Steps 2 and 3 can be repeated over and over with the same result. Only a site restart resolves the problem.

While the above is quite the edge case, this issue becomes a whole lot worse for block based editors. They use the published property data type configuration to determine which blocks to include in output (for validation purposes). If a block is added to the data type configuration and a page is subsequently saved (or published), all blocks of this new type are simply stripped from the output. Or even worse, if a block is removed... all blocks of this type will re-appear after a page is saved.

The following template can be used to perform the test scenario:

@using Umbraco.Cms.Core.PropertyEditors
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@{
    Layout = null;
    var property = Model.GetProperty("textBox") ?? throw new ApplicationException("Model does not contain a textBox property");
    var configuration = property.PropertyType.DataType.ConfigurationAs<TextboxConfiguration>()!;
}
<html lang="en">
<head>
    <title>Property type cache test</title>
</head>
<body>
<ul>
    <li>Max chars: @configuration.MaxChars</li>
</ul>
</body>
</html>

Copy link
Member

@bergmania bergmania left a comment

Choose a reason for hiding this comment

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

Changes looks good to me.

@bergmania bergmania merged commit f286b11 into release/13.0 Nov 17, 2023
@bergmania bergmania deleted the v13/fix/datatype-changes-contenttype-updates branch November 17, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants