[MGNLFE-180] React editor not working when deploying in web-resources in minimal-headless-spa-demo Created: 04/Mar/22  Updated: 09/Mar/22  Resolved: 09/Mar/22

Status: Closed
Project: Magnolia Frontend Helpers
Component/s: React Renderer
Affects Version/s: 1.2.1
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Tu Bo Xuan Assignee: Bartosz Staryga
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2022-03-03 at 10.57.14 AM.png     PNG File Screen Shot 2022-03-03 at 10.57.26 AM.png    
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. Download the demo from https://hd.magnolia-cms.com/docs/getting-started/hello-spa 
  2. Use react demo to build and deploy the "built" into webresources of the light modules. 
  3. Create a page using the spa template (react) 
  4. Open that page inside the Page Editor
  5. It will show a blank page.

.. Logs, screens hots, gifs...

Expected results

.. Justify on-trivial expectations with a link to a doc or a relevant discussion.

Actual results

Workaround

Development notes



 Comments   
Comment by Bartosz Staryga [ 09/Mar/22 ]

Problem
New React Router was stricter the old one in terms of path matching.
When basename was set to be `/react-minimal` the `/react-minimal.html` was not matched.
It was not the issue in external SPA, as iframe src does not have `.html` added.

Solution
I did the Code solution. I removed the React Router and watch for URL changes and rerender PageLoader on such change.

There is also Configuration solution
Just for future reference anyway:
Remove `defaultExtension` from the Magnolia configuration.
https://demo.magnolia-cms.com/.magnolia/admincentral#app:configuration:browser;/server@defaultExtension:treeview:
It would prevent the Magnolia from adding this extension to iframe src.

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