ICEfaces
  1. ICEfaces
  2. ICE-9285

DOM Diff Old DOM stale - results in erroneous update to unrendered region

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: EE-3.3.0.GA, 4.0.BETA, 4.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      *
    • Assignee Priority:
      P1

      Description

      In the showcase ace:breadcrumbMenu example if you perform the following steps you can reproduce a JS error due to an update returning for a region that is not rendered. This is because the old DOM held by DOMDiff is stale and still shows that region as rendered from before the navigation. Upon returning from navigation, a different DOM is rendered due to example state being held in a Window or View scoped bean.

      The steps are as follows:
      1) Expand a province (BC)
      2) Select a city (Vancouver)
      3) Click the province breadcrumb (BC) from "Crumbs with URL"
      4) After Wiki page loads, use the back button to return to the example, note the selections / expansions are lost due to WindowScoped bean expiring.
      5) Expand the province you expanded before (BC) (no updates come back as the old DOM still shows this province as being expanded)
      6) Select another province (Alberta)
      7) JS errors will have been caused trying to update remove the select state from the City it believes is still selected (Vancouver)

      As evidence I've attached the DOM diff debugAB output from the request occurring at step 5. (Though in my test the province expanded was Alberta and the city selected was Edmonton - the effect is the same.)
      1. debugAB.txt
        35 kB
        Nils Lundquist

        Activity

        Hide
        Nils Lundquist added a comment -

        Assigning to Ted for insight into DOM diff old DOM caching.

        Show
        Nils Lundquist added a comment - Assigning to Ted for insight into DOM diff old DOM caching.
        Hide
        Ted Goddard added a comment -

        Seems to work better in Chrome and Firefox than Safari – both lose the expanded state, but in Chrome the page is functional after the back button.

        Show
        Ted Goddard added a comment - Seems to work better in Chrome and Firefox than Safari – both lose the expanded state, but in Chrome the page is functional after the back button.
        Hide
        Ted Goddard added a comment -

        Safari and Chrome have a different pattern of the ice.view value:

        grep -o "ice.view...................................." /tmp/chrome.txt
        ice.view=vktjm1a1z&crumb-form%3Acrumb-tree_s
        ice.view=vktjm1a1z&ice.focus=&ice.event.targ
        ice.view" type="hidden" value="vktjm1a21" />
        ice.view" type="hidden" value="vktjm1a21" />
        ice.view" type="hidden" value="vktjm1a21" />
        ice.view" type="hidden" value="vktjm1a21" />
        ice.view" type="hidden" value="vktjm1a21" />
        ice.view=vktjm1a21&crumb-form%3Acrumb-tree_s
        ice.view=vktjm1a21&ice.focus=&ice.event.targ

        grep -o "ice.view...................................." /tmp/safari.txt
        ice.view=vktjm1a24&crumb-form%3Acrumb-tree_s
        ice.view=vktjm1a24&ice.focus=&ice.event.targ
        ice.view" type="hidden" value="vktjm1a26" />
        ice.view" type="hidden" value="vktjm1a26" />
        ice.view" type="hidden" value="vktjm1a26" />
        ice.view" type="hidden" value="vktjm1a26" />
        ice.view" type="hidden" value="vktjm1a26" />
        ice.view=vktjm1a24&crumb-form%3Acrumb-tree_s
        ice.view=vktjm1a26&ice.focus=&ice.event.targ

        Show
        Ted Goddard added a comment - Safari and Chrome have a different pattern of the ice.view value: grep -o "ice.view...................................." /tmp/chrome.txt ice.view=vktjm1a1z&crumb-form%3Acrumb-tree_s ice.view=vktjm1a1z&ice.focus=&ice.event.targ ice.view" type="hidden" value="vktjm1a21" /> ice.view" type="hidden" value="vktjm1a21" /> ice.view" type="hidden" value="vktjm1a21" /> ice.view" type="hidden" value="vktjm1a21" /> ice.view" type="hidden" value="vktjm1a21" /> ice.view=vktjm1a21&crumb-form%3Acrumb-tree_s ice.view=vktjm1a21&ice.focus=&ice.event.targ grep -o "ice.view...................................." /tmp/safari.txt ice.view=vktjm1a24&crumb-form%3Acrumb-tree_s ice.view=vktjm1a24&ice.focus=&ice.event.targ ice.view" type="hidden" value="vktjm1a26" /> ice.view" type="hidden" value="vktjm1a26" /> ice.view" type="hidden" value="vktjm1a26" /> ice.view" type="hidden" value="vktjm1a26" /> ice.view" type="hidden" value="vktjm1a26" /> ice.view=vktjm1a24&crumb-form%3Acrumb-tree_s ice.view=vktjm1a26&ice.focus=&ice.event.targ
        Hide
        Ted Goddard added a comment -

        Strangely, both of the first POSTs after return from Wikipedia contain two values for ice.view, however in the case of Safari they are inconsistent and in the case of Chrome they have equal values. Since the old value of ice.view does not occur in the page fetched from the server, it must be stored by JavaScript.

        Show
        Ted Goddard added a comment - Strangely, both of the first POSTs after return from Wikipedia contain two values for ice.view, however in the case of Safari they are inconsistent and in the case of Chrome they have equal values. Since the old value of ice.view does not occur in the page fetched from the server, it must be stored by JavaScript.
        Hide
        Ted Goddard added a comment -

        Safari is applying autocomplete to the hidden field ice.view. In this case the behaviour causes a problem, but could be an interesting technique for maintaining a windowID.

        Show
        Ted Goddard added a comment - Safari is applying autocomplete to the hidden field ice.view. In this case the behaviour causes a problem, but could be an interesting technique for maintaining a windowID.
        Hide
        Ted Goddard added a comment -

        Autocomplete would not work well for windowID since the browser would detect a field of the same name but in different windows and use the same value, resulting in multiple different windows with the same ID.

        Show
        Ted Goddard added a comment - Autocomplete would not work well for windowID since the browser would detect a field of the same name but in different windows and use the same value, resulting in multiple different windows with the same ID.
        Hide
        Ted Goddard added a comment -

        Changing

        samples/showcase/showcase/src/main/java/org/icefaces/samples/showcase/view/navigation/NavigationModel.java

        to @ViewScoped (rather than @CustomScoped(value = "#

        {window}

        ") also fixes the problem for Safari. More analysis of the application logic would be necessary to determine why this example is affected by a stale NavigationModel.

        Show
        Ted Goddard added a comment - Changing samples/showcase/showcase/src/main/java/org/icefaces/samples/showcase/view/navigation/NavigationModel.java to @ViewScoped (rather than @CustomScoped(value = "# {window} ") also fixes the problem for Safari. More analysis of the application logic would be necessary to determine why this example is affected by a stale NavigationModel.

          People

          • Assignee:
            Ted Goddard
            Reporter:
            Nils Lundquist
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: