umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.45k stars 2.68k forks source link

Macro's PropertyTypePicker throws error in backoffice #14371

Closed ewuski closed 1 year ago

ewuski commented 1 year ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

Umbraco 10.0.0 (and 9.0.0)

Bug summary

PropertyTypePicker is one of the types available for macro parameters. Same MultiplePropertyTypePicker

It worked fine in v7. However when upgraded to Umbraco 10 the macros that use them throw error in the backoffice. And the list of properties do not display in the macro property dropdown. (The selected property is fine and the macro works in the front-end if already populated) It does the same when creating a fresh new macro with PropertyTypePicker or MultiplePropertyTypePicker in v10.

See related forum post: https://our.umbraco.com/forum/using-umbraco-and-getting-started/109195-macro-with-property-type-picker-throws-error-on-opening

Specifics

Umbraco-9-error

Steps to reproduce

Create a new macro with PropertyTypePicker or MultiplePropertyTypePicker as parameter. Try to add it into a page grid. Error will be thrown and the property dropdown will be empty.

The documentation says they are one of available data types in macros, yet they are not working: https://docs.umbraco.com/umbraco-cms/v/10.latest-lts/reference/templating/macros/managing-macros

Expected result / actual result

It should not throw an error and the properties should display in the macro parameter dropdown.

github-actions[bot] commented 1 year ago

Hi there @ewuski!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

andr317c commented 1 year ago

Hey! I just took a look at your issue, and it should be fixed now. The fix will be out in release 10.6.0 😄

ewuski commented 1 year ago

Great thanks!

dunfe commented 1 year ago

Hey! I just took a look at your issue, and it should be fixed now. The fix will be out in release 10.6.0 😄

Hi andr317c. I'm using Umbraco 11.4.2 and still get the same error. What's wrong?

andr317c commented 1 year ago

Hey @dunfe Sorry for the late reply, the fix for this issue will be in release 11.4.3.😄 The target release for 11.4.3 is next week.

dunfe commented 1 year ago

In case you can't upgrade the Umbraco, I have a solution for you.

`public class HotfixDefinitionMapping : IMapDefinition { public void DefineMaps(IUmbracoMapper mapper) { mapper.Define<IPropertyType, EntityBasic>((source, context) => new EntityBasic(), Map); }

    private static void Map(IPropertyType source, EntityBasic target, MapperContext context)
    {
        target.Alias = source.Alias;
        target.Icon = "icon-box";
        target.Id = source.Id;
        target.Key = source.Key;
        target.Name = source.Name;
        target.ParentId = -1;
        target.Path = string.Empty;
    }
}`

Then add to composer: builder.WithCollectionBuilder<MapDefinitionCollectionBuilder>() .Add<HotfixDefinitionMapping>();

ewuski commented 1 year ago

Hey @dunfe Sorry for the late reply, the fix for this issue will be in release 11.4.3.😄 The target release for 11.4.3 is next week.

This does not resolve the issue for Umbraco 10 though. If it is LTS then the fix should be merged there as well?

andr317c commented 1 year ago

Hey,

The issue should be fixed in 10.6.0! Please let me know if it's still an issue