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

Greenbars sometimes dont load - Update Template Annotations when updated prop is passed to EditorPage

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Done
    • Neutral
    • 1.2.0
    • None
    • None
    • HL & LD 41
    • 3

    Description

      Take nextjs-ssr-minimal example from
      https://git.magnolia-cms.com/projects/DEMOS/repos/minimal-headless-spa-demos/browse?at=refs%2Fheads%2Fnextjs

      We want to fetch Template Annotations in the browser to have p13n working (session cookie to have correct selected variants).

      We can not render EditablePage, fetch the template annotations, and pass the new templateAnnotation prop to EditablePage, as the components are not updated then.

      It is maybe due to storing template annotations in state and not updating state on new props.

      Hence we had to use a trick as follows:
      https://git.magnolia-cms.com/projects/DEMOS/repos/minimal-headless-spa-demos/browse/spa/nextjs-ssr-minimal/pages/%5B%5B...pathname%5D%5D.js?at=refs%2Fheads%2Fnextjs#98

      This causes (my guess here) race condition as page sometimes loads faster then JS loaded by bridge and there is no green bars at all.

      Link to the video: https://magnolia-cms.slack.com/archives/G012JS95BRT/p1638970438031400?thread_ts=1638968179.030000&cid=G012JS95BRT

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                canh.nguyen Canh Nguyen
                bstaryga Bartosz Staryga
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Task DoD

                    Time Tracking

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