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

Discovery to support for Next.js 13+ App Router

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Done
    • Critical
    • None
    • None
    • None
    • None

    Description

      This has been the Discovery Ticket.

      The feaature will be implemented with this epic: https://jira.magnolia-cms.com/browse/MGNLFE-558

       

      Next.js 13 introduced new routing mechanism called: App Router
      **

      It is recommended way of routing for new apps, and old should migrate as per: https://nextjs.org/docs/app

      It also introduced the idea of Server and Server Components, to explicitly split between code rendered on server and on client side.

      @magnolia/react-editor is using React context to share data between components.
      New approach does not allow using context in server components throwing error:

      TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component 

      Using `use client` makes the fetching of page data happen on client side = opposite what we want from Next.js

      We should refactor React lib to stop using context for sharing data across components.

      Ideally using vanilla JS that would avoid conflicting with any changes in the future.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                oanh.thai Oanh Thai Hoang
                bstaryga Bartosz Staryga
                DeveloperX
                Votes:
                2 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Work Started:

                  Checklists

                    Task DoD

                    Time Tracking

                      Estimated:
                      Original Estimate - Not Specified
                      Not Specified
                      Remaining:
                      Remaining Estimate - Not Specified
                      Not Specified
                      Logged:
                      Time Spent - 4d 1.5h
                      4d 1.5h