rickbutterfield/Umbraco.Community.BlockPreview

Multi-node Tree Picker property editor in Block List block causes duplicated block previews

Closed this issue · 5 comments

Which Umbraco.Community.BlockPreview version are you using?

1.10.3

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

13.4.1

Bug summary

When an element type (block) within a Block List contains a Multi-Node Tree Picker property editor, the preview of the first block in the block list is rendered for all other blocks. Even after removing the block containing the multi-node tree picker and re-saving the content, the block previews are still duplicated.

Steps to reproduce

Just a note, in testing this, I was using a clean install of Umbraco with the official Umbraco Starter Kit added to it.

  1. Create a Block List property editor containing several blocks (e.g. the Headline and Rich Text blocks that come in the demo set of blocks).
  2. Ensure the blocks use the block preview from the package (~/App_Plugins/Umbraco.Community.BlockPreview/views/block-preview.html).
  3. Create a new block (element type) and add a Multi-node Tree Picker property editor to it that picks up to 1 item from a collection of content in the CMS.
    For example, a Blogpost block that contains a multi-node tree picker property editor to pick the blog post:
    image
    image
  4. Create a Razor view for the Blogpost block and save it in Views/Partials/blocklist/Components/.
    For example:
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem>;
@using ContentModels = Umbraco13Demo.Web.Models.PublishedContent;
@{
    var blogpostBlock = (BlogpostBlock)Model.Content;

    var blogpost = blogpostBlock.Content as ContentModels.Blogpost;
}
<div class="component blogpost">
    <h4>@blogpost.Name</h4>
</div>
  1. Go to a CMS page that uses the Block List property editor and create an instance of 'Headline' block (or other block). Then add an instance of the block that uses the multi-node tree picker property editor (e.g. Blogpost block).

Expected result / actual result

Each block should render a preview using the HTML defined for that block's razor file. Instead, the first block's preview is duplicated for all other blocks.

image

Even after removing the block containing the multi-node tree picker, the previews still seem to be duplicated.

image

IMPORTANT NOTE: This bug does not occur in a Block Grid property editor.

Hi @rickbutterfield. Thanks for this amazing plugin!
Just wondering whether you might have some availability soon to investigate this ticket?

Hey @timeverts! There was another issue raised recently where Block List items were duplicated, fixed in 1.10.4 (see some of the later comments on #64)

Please could you try that first, and if it doesn't fix it I'll investigate further!

I have tested this in Umbraco v13.2, v13.4.1, & v13.5.1 and I cannot replicate this issue using BlockPreview v1.10.4. I think this issue is safe to close. @timeverts if this is still happening on v1.10.4, please provide some additional information and I would be happy to take a look.

Hey @timeverts! Please can you confirm if this is still an issue? If not I'll close the issue 😊

@rickbutterfield, my apologies for taking so long to look into this again. Now that I've updated from v1.10.3 to v1.10.5 I can confirm the issue is resolved. I suspect it was resolved in 1.10.4, as you mentioned.

Thanks for all your work on this amazing plugin.