[MGNLFE-372] Creating component variant breaks editor JS Created: 17/Nov/22  Updated: 23/Oct/23  Resolved: 31/Jan/23

Status: Closed
Project: Magnolia Frontend Helpers
Component/s: None
Affects Version/s: 1.3.1
Fix Version/s: 1.3.2

Type: Bug Priority: Blocker
Reporter: Tobias Kerschbaum Assignee: Canh Nguyen
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: 3d 3h
Original Estimate: Not Specified

Attachments: PNG File image-2022-11-17-10-32-21-730.png    
Issue Links:
Relates
relates to MGNLFE-309 Create variants for component-with-ar... Closed
relates to PAGES-761 Personalization of components which c... Closed
relates to MGNLFE-404 Should check variant before working o... Closed
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:
Epic Link: SPA Maintenance
Team: DeveloperX
Work Started:

 Description   

Steps to reproduce

  1. Create a component variant in FE-Helper 1.3.1
  2. See the broken page

Expected results

See my beautiful component variant.

Actual results

My page is broken and I cannot do anything anymore.

Workaround

There is no workaround.

Development notes



 Comments   
Comment by Christopher Zimmermann [ 17/Nov/22 ]

Which framework? React, Vue, Angular?
Can you share the project where it is not working - or any other details?

Comment by Bartosz Staryga [ 17/Nov/22 ]

We have noticed it on Next.js based project: insurance demo.
https://gitlab.magnolia-platform.com/regional-emea/services-sales-demo-frontend/-/tree/sales-demo-integration/insurance-demo

Rolling back to 1.3.0 makes it work again.
We have not looked yet at other projects.

Comment by Christopher Zimmermann [ 24/Nov/22 ]

oanh.thai verified that the feature does work on the react-sample project which is a part of the frontend-helpers project.
See: https://magnolia-cms.slack.com/archives/C02RDS0KBHQ/p1668761549700599?thread_ts=1668682108.403759&cid=C02RDS0KBHQ

 

Comment by Christopher Zimmermann [ 23/Jan/23 ]

Reopening as developer (bstaryga ) still has the problem on project.

bstaryga  Is there a project that the team can use to reproduce the issue? Does it need to be SSR?

Comment by Bartosz Staryga [ 23/Jan/23 ]

The error is thrown here

variant is undefined and JS can not perform replace on it.

czimmermann we reproduce it on our demo instance.
The error, though, is not making sure the variant exists before running the function on it. The code would break always if the endpoint did not return an exact response which leads me to...

...Question
variant is defined by templateAnnotations[path + '/variants/' + selectedVariant] but our template annotations endpoint does not return keys with /variants/. Is this something that was introduced with the newer template annotations endpoint?

Comment by Canh Nguyen [ 27/Jan/23 ]

Hi bstaryga ,

What Magnolia version are you using? PAGES-761 is fixed on 6.2.23.

Comment by Bartosz Staryga [ 27/Jan/23 ]

We are on `6.2.26`.

Comment by Christopher Zimmermann [ 31/Jan/23 ]

Closing this ticket as the "new problem" was caused by incorrect usage of the system.

To cover this error and log a warning we introduce more checks in the code. We will also improve documentation of how to use SPA editor on another workspace - including with personalizaion.

See: https://jira.magnolia-cms.com/browse/MGNLFE-404

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