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

Only render editable-page when the content is not empty will break the SPA

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Neutral
    • None
    • None
    • None
    • None

    Description

      Steps to reproduce

      1. Add condition to render editable-page like this: 
        <editable-page *ngIf="content" [content]="content"></editable-page>
      2. The app will stop working

      .. Logs, screenshots, gifs...

      Expected results

      The app should work

      Actual results

      The console shows errors, and no green bars.

      Workaround

      Development notes

      When the content is set to the editable-page, editable-page tries to set values to its children, but the editable-page's children are not ready yet.

      Wrap the logic to setTimeout method may help fix this issue or try to check the commentComponent until it's ready.

      @Input() set content(content: object) {
        setTimeout(() => { // a delay to make sure editable-page's children are rendered
          if (content && this.editorContext.inIframe()) {
            this.updateComment(content);
            this.editorContext.onFrameReady();
            this.editorContext.refresh();
          }
        }, 0);
      } 

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              canh.nguyen Canh Nguyen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Checklists

                  Bug DoR
                  Task DoD