Uploaded image for project: 'Magnolia Frontend Helpers'
  1. Magnolia Frontend Helpers
  2. MGNLFE-54

No Add Component action with Angular 9

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 1.0.4
    • 1.0.2
    • None
    • None
    • Yes
    • HL & LD 5
    • 1

    Description

      Description was: parentTemplateId no guaranteed to be set before content editable-area.component.ts

      Description/Cause
      In this line (https://git.magnolia-cms.com/projects/MODULES/repos/frontend-helpers/browse/packages/angular-editor/projects/angular-editor/src/lib/area/editable-area.component.ts#33 ), the content(input) is being tried to be set with a setter. The setter uses another property called parentTemplateId which also is a Input.

      The problem here is, that Angular can't guarantee that the setters of the Inputs are everytime called in the same order (or at least since Ivy). Here is an issue from GitHub describing the problem: https://github.com/angular/angular/issues/34322

      Steps to reproduce

      • it should be possible to reproduce the problem with the hello-spa Angular App. Just upgrade it to Angular 9 (or maybe Angular 8 also works) and make sure to enable Ivy in Angular.
      • When you’ve the Angular Universal application up and running, create a new page in Magnolia and try to add a new component. You’ll see, that there isn’t a way to add a new component (Buttons disabled). This is due to parentTemplateId being null, thus no availableComponents found in "content" parameter in setter. Due to the reason that there are no availableComponents, Magnolia disables/hides all buttons to add a new component.

      Possible fix:
      A possibility to fix this issue is using the ngOnChanges lifecycle hook. Another option may be to also set the content when setting parentTemplateId, however I’m not sure if this is going to cover all cases. And of course some others

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              canh.nguyen Canh Nguyen
              miruela Mercedes Iruela
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD

                  Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0d
                    0d
                    Logged:
                    Time Spent - 1d
                    1d