Follow-up to #456 (merged in PR #457).
#456 stopped the pages from holding direct singleton references, but the components those pages hand the resource to still capture it. Examples:
ViewList(markupId, resourceWithProfile) — captures resourceWithProfile in anonymous inner ListView classes (populateItem references it at render time).
SpaceUserList(markupId, space) — same pattern.
ItemListPanel constructed with setResourceWithProfile(space) or a Supplier<R> bound to a live object via space::getRoles.
When the page is serialized to the page store, these captured references serialize with the component tree. On F5 the deserialized component tree holds a snapshot that doesn't share identity with the live singleton in SpaceRepository / MaintainedResourceRepository.
Proposed change
Change component constructors to accept IModel<T> instead of T, store the model via setDefaultModel(model), and call getModelObject() at populate/render time. Page call sites then pass through the LDM they already hold (spaceModel, resourceModel).
Scope
component/ViewList.java
component/SpaceUserList.java
component/ItemListPanel.java (the setResourceWithProfile setter + the ReadyFunction/ResultFunction paths bound to live objects)
- Any other component that takes a raw
Space / MaintainedResource / AbstractResourceWithProfile
Priority
Defer until needed. The repositories are session-stable enough that this rarely shows user-visible staleness, and the auto-refresh-on-publish redirect already kicks in for genuine data changes. Worth doing if a specific bug surfaces, or as part of a larger refactor that touches these components anyway.
Follow-up to #456 (merged in PR #457).
#456 stopped the pages from holding direct singleton references, but the components those pages hand the resource to still capture it. Examples:
ViewList(markupId, resourceWithProfile)— capturesresourceWithProfilein anonymous innerListViewclasses (populateItemreferences it at render time).SpaceUserList(markupId, space)— same pattern.ItemListPanelconstructed withsetResourceWithProfile(space)or aSupplier<R>bound to a live object viaspace::getRoles.When the page is serialized to the page store, these captured references serialize with the component tree. On F5 the deserialized component tree holds a snapshot that doesn't share identity with the live singleton in
SpaceRepository/MaintainedResourceRepository.Proposed change
Change component constructors to accept
IModel<T>instead ofT, store the model viasetDefaultModel(model), and callgetModelObject()at populate/render time. Page call sites then pass through the LDM they already hold (spaceModel,resourceModel).Scope
component/ViewList.javacomponent/SpaceUserList.javacomponent/ItemListPanel.java(thesetResourceWithProfilesetter + theReadyFunction/ResultFunctionpaths bound to live objects)Space/MaintainedResource/AbstractResourceWithProfilePriority
Defer until needed. The repositories are session-stable enough that this rarely shows user-visible staleness, and the auto-refresh-on-publish redirect already kicks in for genuine data changes. Worth doing if a specific bug surfaces, or as part of a larger refactor that touches these components anyway.