[MGNLFE-119] templateAnnotations/templateDefinitions empty check issue Created: 23/Sep/21  Updated: 15/Oct/21  Resolved: 01/Oct/21

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

Type: Bug Priority: Critical
Reporter: Bartosz Staryga Assignee: Robert Šiška
Resolution: Fixed Votes: 0
Labels: VN-Testing
Remaining Estimate: Not Specified
Time Spent: 0.5d
Original Estimate: Not Specified

Issue Links:
relation
is related to MGNLFE-135 Only render page annotation when the ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Epic Link: Headless p13n
Sprint: HL & LD 38
Story Points: 3

 Description   

In EditablePage in React templateAnnotations/templateDefinitions can not be null/undefined.

In area addComment is always run
https://git.magnolia-cms.com/projects/MODULES/repos/frontend-helpers/browse/packages/react-editor/src/component/EditableArea/EditableArea.js#37

and openComment is always assigned:
https://git.magnolia-cms.com/projects/MODULES/repos/frontend-helpers/browse/packages/react-editor/src/component/EditableArea/EditableArea.js#62

Meaning this code is run: templateAnnotations[content['@path']

So to make it work we pass templateAnnotations as empty object.

Problem is that in many places in code we can find things like
if (templateAnnotations)
eg: https://git.magnolia-cms.com/projects/MODULES/repos/frontend-helpers/browse/packages/react-editor/src/component/EditablePage/EditablePage.js#58

And in JS if ({}) is true hence this check is not working as it should.

Lets allow passing templateAnnotations/templateDefinitions as null/undefined so all the if against it work


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