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

Should check variant before working on it

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Neutral
    • 1.3.3
    • 1.3.2
    • None
    • None
    • DevX 29, DevX 30
    • 1

    Description

      Currently, some actions always have been done on the variant variable. However, we should do some checks to make sure the variable has the correct value for backward compatibility.

      const variant = templateAnnotations[path + '/variants/' + selectedVariant];
      modified[path] = variant.replace(contentAttributeRegex, comment.match(contentAttributeRegex)[0]);
      modified[path] = modified[path].concat(' ', comment.match(variantsAttributesRegex).join(' '));
      modified[path] = modified[path].concat(' ', `selectedVariant="${selectedVariant}"`); 

      Note:

      • The variant is only null/undefined if the template annotation endpoint definition is wrong.

       

      Technical detail:

      When there is a variant on a page and the user uses the Edit page function, there will be an error.

      Steps to reproduce on frontend-helper/samples/react-sample:

      1. Using frontend-helper 1.3.0:

      • Create a page
      • Create a title component
      • Create some variants on the title component

      2. Add and template annotation endpoint definition to light-modules, ex: light-modules/react-lm/restEndpoints/templateAnnotations/website.yaml

      implementationClass: info.magnolia.rendering.spa.rest.v1.TemplateAnnotationEndpoint
      workspace: website
      endpointPath: template-annotations/v1/website
      bypassWorkspaceAcls: true

      3. Edit .env file to add website

      REACT_APP_MGNL_API_TEMPLATES=/.rest/template-annotations/v1/website 

      4. Using frontend-helper 1.3.2:

      • Edit the page above
      • Lock at the browser console

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            There are no Sub-Tasks for this issue.

            Activity

              People

                plequoc Phong Le Quoc
                plequoc Phong Le Quoc
                DeveloperX
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Work Started:

                  Checklists

                    Task DoD