Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview error when using, in nested blocks, an Umb.PropertyEditorUi.ContentPicker on 3.0.0 with umbraco 15.1.1 #87

Open
isIulian opened this issue Jan 19, 2025 · 7 comments
Labels
bug Something isn't working

Comments

@isIulian
Copy link

Which Umbraco.Community.BlockPreview version are you using?

3.0.0

Which Umbraco version are you using? For example: 10.4.0 - don't just write v10

15.1.1

Bug summary

In a umbraco project I'm using the packages blockgrid to create a block of products.
The products property is a Nested BlockList in which you can use a block to populate
the product card or one with a content picker to point to specific doc types of the tree.
On nested block the content picker is of the property Umb.PropertyEditorUi.ContentPicker
and when setted with a value the generated preview for the backoffice fails.

Image

However, with a direct block and the same property type the problem isn't happening.

Image

System.FormatException: String "[{"type": "document"" is not a valid udi.
   at Umbraco.Cms.Core.UdiParser.ParseInternal(String s, Boolean tryParse, Boolean knownTypes, Udi& udi)
   at Umbraco.Cms.Core.UdiParser.Parse(String s)
   at System.Linq.Enumerable.ArraySelectIterator`2.ToArray()
   at Umbraco.Cms.Core.PropertyEditors.ValueConverters.MultiNodeTreePickerValueConverter.ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, Object source, Boolean preview)
   at Umbraco.Cms.Core.Models.PublishedContent.PublishedPropertyType.ConvertSourceToInter(IPublishedElement owner, Object source, Boolean preview)
   at Umbraco.Cms.Core.PublishedCache.PublishedElementPropertyBase.GetInterValue()
   at Umbraco.Cms.Core.PublishedCache.PublishedElementPropertyBase.GetValue(String culture, String segment)
   at Umbraco.Extensions.PublishedPropertyExtension.Value[T](IPublishedProperty property, IPublishedValueFallback publishedValueFallback, String culture, String segment, Fallback fallback, T defaultValue)
   at Umbraco.Extensions.PublishedElementExtensions.Value[T](IPublishedElement content, IPublishedValueFallback publishedValueFallback, String alias, String culture, String segment, Fallback fallback, T defaultValue)
   at Umbraco.Cms.Web.Common.PublishedModels.SingleProductInternalPreviewBlock.get_PreviewContent() in umbraco-based-project\umbraco\models\SingleProductInternalPreviewBlock.generated.cs:line 66
   at AspNetCoreGeneratedDocument.Views_Partials_blockgrid_Components_productsPreviewBlock_productsPreviewBlock.ExecuteAsync() in umbraco-based-project\Views\Partials\blockgrid\Components\productsPreviewBlock\productsPreviewBlock.cshtml:line 48
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Umbraco.Community.BlockPreview.Services.BlockPreviewService.GetMarkupFromPartial(ControllerContext controllerContext, ViewDataDictionary viewData, String contentAlias, BlockType blockType)
   at Umbraco.Community.BlockPreview.Services.BlockPreviewService.GetMarkupFromPartial(ControllerContext controllerContext, ViewDataDictionary viewData, String contentAlias, BlockType blockType)
   at Umbraco.Community.BlockPreview.Services.BlockPreviewService.GetMarkup(ControllerContext controllerContext, String contentAlias, ViewDataDictionary viewData, BlockType blockType)
   at Umbraco.Community.BlockPreview.Services.BlockPreviewService.RenderGridBlock(String blockData, IPublishedContent content, ControllerContext controllerContext, String blockEditorAlias, Guid documentTypeUnique, String contentKey, String settingsKey)
   at Umbraco.Community.BlockPreview.Controllers.BlockPreviewApiController.PreviewGridBlock(String blockData, Guid nodeKey, String blockEditorAlias, String contentElementAlias, String culture, Guid documentTypeUnique, String contentUdi, String settingsUdi)

The exception is in the UdiParser class of Umbraco that receives a bad formatted from the property value converter MultiNodeTreePickerValueConverter.ConvertSourceToIntermediate

Ps. I'm not sure is related but with contentPicker there are some older issues/74

Steps to reproduce

  • Register a BlockList property on a document type
  • Setup the BlockList property to add a block that itself has BlockList Property
  • The nested BlockList should be configured with a block that a property of
    Umb.PropertyEditorUi.ContentPicker.

Blocks setup from document page:

  • PageBlocks
    • Products Previews
      • Preview Card (to manually populate the card data)
      • Content Preview Card (content Picker to select node and autofill card from node fields)

Expected result / actual result

Indifferently from the nested level of the content picker property the preview should be generated.

@isIulian isIulian added the bug Something isn't working label Jan 19, 2025
@rickbutterfield
Copy link
Owner

@isIulian as with #88, I'm hoping to have a fix released for this tomorrow 🤞

@rickbutterfield
Copy link
Owner

@isIulian v3.2.0 is now on NuGet, please test and report back!

@rickbutterfield
Copy link
Owner

@isIulian as reported on #88, v3.2.1 is on NuGet now with another fix for this issue

@isIulian
Copy link
Author

isIulian commented Feb 5, 2025

Hi @rickbutterfield, sorry for the late response. I was a little busy with some tasks and wanted to test the "feature fix" without haste.
Today I updated directly to the version 3.2.3, still doesn't work with content picker in a block that is used in blockgrid (nested or not).

Image
Direct block

Image
Nested block

The message and stacktrace of the exception is still the same.
Let me know if I can look up some configuration, logs, etc... to pinpoint the possible problem.

PS. I tried version 3.2.0, 3.2.1 and 3.2.3 of the package to ensure is not a possible regression on latest version

@rickbutterfield
Copy link
Owner

rickbutterfield commented Feb 6, 2025

@isIulian this is very odd as I can't see the same behaviour on my test site! Please can you confirm what version number is showing up under Packages section > Installed tab?

Also, are you still running Umbraco 15.1.1 or have you upgraded to 15.2?

@isIulian
Copy link
Author

isIulian commented Feb 6, 2025

@rickbutterfield on the project I'm using 3.0.0 at the moment.

I will upgrade it to 3.2.3 in the next days.
I tested with this version on a dedicated branch not the main one of the project for now.
As for Umbraco I'm still on 15.1.1.

I will try to make the same configuration on the test site on the repository and will let you know or share somehow if on the test site will verify the same problem to have the same base.

Thank you

@snappercrumpleddog
Copy link

@rickbutterfield Just to let you know that we are getting the same error on Umbraco version 15.2 and version 3.2.4 of the BlockPreview.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants