Hi,

The following documentation in ComponentResources is misleading in Tapestry 
5.3.2.

    /**
     * Discards all persistent field changes for the page containing the 
component. Changes are eliminated from
     * persistent storage (such as the {@link 
org.apache.tapestry5.services.Session}) which will take effect in the
     * <em>next</em> request (the attached page instance is not affected).
     */
    void discardPersistentFieldChanges();

Previously (5.2.6), it behaved as documented, but now (I think) changes to the 
PersistWorker mean that ComponentResources is called when the field is 
accessed, not just when it is set:

  public Object get(Object instance, InstanceContext context)
        {
            if (!fieldValue.exists())
            {
                Object persistedValue = resources.hasFieldChange(name) ? 
resources.getFieldChange(name) : defaultValue;

                fieldValue.set(persistedValue);
            }

            return fieldValue.get();
  }

This means that calling discardPersistentFieldChanges() before accessing the 
persisted fields results in them not being there - "the attached page instance 
is not affected".

Luke

Reply via email to