rickbutterfield / Umbraco.Community.BlockPreview

Easy to use rich HTML backoffice previews for the Umbraco Block List and Block Grid editors.
MIT License
20 stars 12 forks source link

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

Open timeverts opened 2 months ago

timeverts commented 2 months ago

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>
  5. 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.

timeverts commented 1 month ago

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

rickbutterfield commented 1 month ago

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!

kevin9092 commented 1 month ago

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.

rickbutterfield commented 1 week ago

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