rickbutterfield / Umbraco.Community.BlockPreview

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

BlockGridItem contains no Areas when rendering preview #15

Closed 37Stars closed 1 year ago

37Stars commented 1 year ago

I have created a new Tabbed Container block. It has a single area that accepts only Tab Content blocks. I created a page with a Tabbed Container block and was able to add 2 Tab Content blocks, though it wasn't easy because the Circled Plus icon would nearly always open the Settings panel AND a panel to add Blocks (same level as the Tabbed Container block).

When debugging the view while navigating to that page on the front end, I could see that the Areas property had data, two items in this instance. The Column span property also had a value, 12.

When debugging the view while previewing in the backoffice, the Areas property had zero data and the column span property was 0.

This seems like it's an issue, but the preview does show the contents of the areas from other layout blocks. This makes me think the Areas property data is loaded later than it should be. When the Tabbed Container block view is called the Areas property is empty, which means I cannot render the tabs before rendering the tab contents.

I hope this makes sense.

rickbutterfield commented 1 year ago

Hey @37Stars! If you could attach any screenshots that you think might help, that'd be great. I'll try and recreate from your description.

37Stars commented 1 year ago

@rickbutterfield , this can be done with the default Block Grid blocks. Here is my test project, UmbracoProject-PreviewTest.zip

Place a breakpoint in umbBlockGridDemoTwoColumnLayoutBlock.cshtml. When you hit the breakpoint from viewing the page on the front end Model.Areas contains elements. When you hit the same breakpoint while previewing in the back end, Model.Areas is empty.

rickbutterfield commented 1 year ago

@37Stars I believe this should now be fixed in 1.6.0!