[MGNLFE-166] Only render editable-page when the content is not empty will break the SPA Created: 27/Jan/22  Updated: 08/Sep/22

Status: Accepted
Project: Magnolia Frontend Helpers
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Canh Nguyen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 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);
} 


 Comments   
Comment by Christopher Zimmermann [ 08/Sep/22 ]

There have been changes to the libraries since this ticket was created. Is the ticket still valid?

Generated at Mon Feb 12 05:44:53 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.