Tapestry 5
  1. Tapestry 5
  2. TAP5-374

Persistent (@Persist) fields not set correctly between requests if they are initialised from pageAttached() method

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.15, 5.0.16
    • Fix Version/s: 5.1.0.1
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      I am seeing unexpected behaviour when using persistent fields and the
      page lifecycle method, pageAttached(), (T 5.0.15).

      I have a persistent field,

      @Persist
      private Map myMap;

      I also have a page lifecycle method,

      void pageAttached() {
      if (myMap == null)

      { myMap = new HashMap(); }

      }

      I expect that when the page first loads and myMap is null then myMap
      will be initialised to an empty map, thereafter I expect anything I put
      into the map to persist across requests.

      What I actually see is that, if the above pageAttached method is present
      then any data that I put into myMap does not persist across requests
      (the map is always empty). I was not expecting this.

      If I do not initialise myMap in pageAttached then data does persist.

      By design or bug?

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Joel Halbert
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development