Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-87859

Error in product menu when adding a widget to a fragment in a template


    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: Master
    • Fix Version/s: Master
    • Component/s: ~[Archived] WCM
    • Labels:


      Steps to reproduce:

      1. Add a Fragment Collection
      2. Add a Fragment Entry with a widget (<lfr-widget-nav></lfr-widget-nav)
      3. Create a page template and add the fragment
      4. Configure the fragment so that it shows the secondary navigation menu
      5. Save
      6. Reload the page

      Expected result: The product menu is functional

      Actual result: js errors are thrown in the console and the product menu is not functional


      Extended steps to reproduce:

      0) Go to Build -> Page Fragments, create a new collection and a fragment in it with the following code:


      1) Go to Build -> Pages -> Page Templates, create a new Collection and a Content page template in it, add the fragment from (0) to the page template.

      2) Add a breakpoint in ScriptDataPortletFilter, line 77 (_flushScriptData call),  

      3) Go to the page template from (1) and refresh it. When it stops on the breakpoint (2), check that current portlet is Navigation Menu, but the only ScriptData in the request belongs to the GroupPagesPortlet(screenshot 1). 

      4) Add a breakpoint in FragmentEntryRenderUtil, line 146(return of renderFragmentEntryLink call), continue with the execution.

      5) When it stops on the breakpoint (4), check that rendered html of the fragment contains script, which belongs to the GroupPagesPortlet (screenshot 2). Disable breakpoints and continue.

      6) On the Page template, try to open a product menu, assert JS error in the browser console, product menu doesn’t work, sidebar fails. (screenshot 3). It happens because the script loaded in (4) was already loaded and executed and when it happens with the Metal.JS components (Chema, correct me if I’m wrong), we are registering twice the same component, and even in our own code(see component.es.js, line 176) we warn the users that it can lead(in fact, it leads) to the unexpected behaviour.


        1. LPS-87859.webm
          8.73 MB
        2. LPS-87859-1.png
          715 kB
        3. LPS-87859-2.png
          970 kB
        4. LPS-87859-3.png
          733 kB

          Issue Links



              • Assignee:
                kyle.miho Kyle Miho
                jurgen.kappler Jürgen Kappler
                Participants of an Issue:
                Recent user:
                Kyle Miho
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created:
                  Days since last comment:
                  1 year, 32 weeks ago


                  Version Package