Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-11434

Fix JSF duplicate id when rerendering actions in ajax

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Severity: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.7.1
    • Component/s: Layouts & Widgets
    • Backlog priority:
      500

      Description

      When switching the current document using ajax (for instance selecting assets in DAM interface), actions associated to the current document can trigger a duplicate id.

        Issue Links

          Activity

          Hide
          Anahide Tchertchian added a comment - - edited

          Problem appears when the list of actions contains the same actions (and the new selection adds more actions to the list).

          Problem is independent from the layout/widget system, but linked to the c:forEach tag behaviour in ajax.

          Components representing "old" actions are found in the JSF tree by facelets, and are applied the new iteration variable value when they change. But the id on components is not computed again, hence the duplicate id.

          Detailed use case:

          • page is rendered (not in ajax), displaying 2 actions, action_A and action_B.
          • page is re-rendered in ajax, displaying now 4 actions, in this order: action_C, action_D, then again action_A and action_B.

          Old JSF component representing action_A is reused for new action_C, but its id is kept as is so it will be using "action_A_id".
          Same for action_D, reusing the old component for action_B, so its id is "action_B_id".
          A new component is created for action_A, as it was not in the previous tree (there was no third item), and it will be using "action_A_id" => duplicate id.

          Old actions are found because the detection system relies on the facelets tagConfigId, that is not supposed to change depending on the c:forEach items variable value.

          Show
          Anahide Tchertchian added a comment - - edited Problem appears when the list of actions contains the same actions (and the new selection adds more actions to the list). Problem is independent from the layout/widget system, but linked to the c:forEach tag behaviour in ajax. Components representing "old" actions are found in the JSF tree by facelets, and are applied the new iteration variable value when they change. But the id on components is not computed again, hence the duplicate id. Detailed use case: page is rendered (not in ajax), displaying 2 actions, action_A and action_B. page is re-rendered in ajax, displaying now 4 actions, in this order: action_C, action_D, then again action_A and action_B. Old JSF component representing action_A is reused for new action_C, but its id is kept as is so it will be using "action_A_id". Same for action_D, reusing the old component for action_B, so its id is "action_B_id". A new component is created for action_A, as it was not in the previous tree (there was no third item), and it will be using "action_A_id" => duplicate id. Old actions are found because the detection system relies on the facelets tagConfigId, that is not supposed to change depending on the c:forEach items variable value.
          Hide
          Jenkins added a comment -

          SUCCESS: Integrated in nuxeo-jsf-master #989
          NXP-11434: handle dupe id on ajax re-render by making the nxu:repeat tag able to re-create components from scratch when iteration items change (at: 491c8aa1c60235ebe302e9ad62d3963d1d7e5257)

          Show
          Jenkins added a comment - SUCCESS: Integrated in nuxeo-jsf-master #989 NXP-11434 : handle dupe id on ajax re-render by making the nxu:repeat tag able to re-create components from scratch when iteration items change (at: 491c8aa1c60235ebe302e9ad62d3963d1d7e5257 )
          Hide
          Jenkins added a comment -

          SUCCESS: Integrated in nuxeo-jsf-master #994
          NXP-11434: update nxu:repeat tag documentation (at: 4aa3d33a5bf12b834fb37f4bd4ede6847e31476b)

          Show
          Jenkins added a comment - SUCCESS: Integrated in nuxeo-jsf-master #994 NXP-11434 : update nxu:repeat tag documentation (at: 4aa3d33a5bf12b834fb37f4bd4ede6847e31476b )
          Hide
          Anahide Tchertchian added a comment -

          reopen: the "index" attribute is not exposed anymore

          Show
          Anahide Tchertchian added a comment - reopen: the "index" attribute is not exposed anymore
          Hide
          Jenkins added a comment -

          SUCCESS: Integrated in nuxeo-jsf-master #996
          NXP-11434: add back index exposure on nxu:repeat tag (at: 55363f5f6199e106def71f52f5992e2cf4926a54)

          Show
          Jenkins added a comment - SUCCESS: Integrated in nuxeo-jsf-master #996 NXP-11434 : add back index exposure on nxu:repeat tag (at: 55363f5f6199e106def71f52f5992e2cf4926a54 )

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: