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 · 3 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

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

2 participants