Skip to content

Convert ViewList/SpaceUserList/ItemListPanel to take IModel<T> instead of T (#456 follow-up) #459

@tkuhn

Description

@tkuhn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions