Skip to content

fix: restore F5 form-state preservation via singleton LDMs (#456)#457

Merged
tkuhn merged 2 commits into
masterfrom
fix-f5-form-state-singleton-ldm
May 12, 2026
Merged

fix: restore F5 form-state preservation via singleton LDMs (#456)#457
tkuhn merged 2 commits into
masterfrom
fix-f5-form-state-singleton-ldm

Conversation

@tkuhn
Copy link
Copy Markdown
Contributor

@tkuhn tkuhn commented May 12, 2026

Summary

  • Revert ONE_PASS_RENDER (introduced in Instances sometimes get slow and eventually unresponsive after a while #401) so Wicket falls back to its default REDIRECT_TO_BUFFER strategy — F5 restores the stored page instance, which preserves partly-filled form values on PublishPage, GenPublishPage, and the connector forms.
  • Hold only the resource id in the page state on SpacePage and MaintainedResourcePage; wrap the Space / MaintainedResource in a LoadableDetachableModel so restored pages re-fetch the live singleton instead of rendering from a serialized snapshot.
  • Route AjaxLazyLoadPanel inner classes, ItemListPanel suppliers, and addSubspacePanel through the model; override onDetach().
  • Fix the three Model.of(\"back to \" + findById().getLabel()) snapshots in ExplorePage with LoadableDetachableModel.
  • Wrap the home resource in HomePage's lazy-loaded ViewList path in a LoadableDetachableModel.

Implements the plan in #456. Other pages flagged as medium-risk there (ResourcePartPage, UserPage, SearchPage, ChannelPage, ListPage, PreviewPage, ViewPage, SpaceListPage, DownloadRdfPage) were left untouched — convert any that surface stale data during testing.

Closes #456.

Test plan

  • mvn -o clean compile passes
  • mvn -o test passes (682 tests, 0 failures)
  • Open /publish?template=..., partly fill the form, press F5 — values are restored
  • Navigate to a Space page, publish something targeted at it (e.g. add a member/role) from another tab, and confirm the originating Space page reflects the new data after F5 (auto-refresh + LDM both apply)
  • Same check for a Maintained Resource page
  • Visit /explore?id=<term>&context=<spaceId|resourceId|userId> — the "back to ..." link shows the current label
  • Visit / — home resource views load both fast-path and via the lazy loader

🤖 Generated with Claude Code

tkuhn and others added 2 commits May 12, 2026 09:07
… with LDMs

Revert the ONE_PASS_RENDER render strategy introduced in #401 so Wicket's
default REDIRECT_TO_BUFFER returns: F5 restores the stored page instance,
which preserves partly-filled form values (PublishPage, GenPublishPage,
connector forms).

The reason #401 switched to ONE_PASS_RENDER was that pages held direct
references to mutable singleton data (Space, MaintainedResource), so a
restored page rendered stale HTML. Address that root cause by holding
only the id in the page state and wrapping the resource in a
LoadableDetachableModel that re-fetches the singleton on every render.

- WicketApplication: drop the ONE_PASS_RENDER setting (and unused
  RequestCycleSettings import) so Wicket falls back to its default.
- SpacePage / MaintainedResourcePage: replace the final Space / final
  MaintainedResource field with String id + IModel<...> LDM; route
  AjaxLazyLoadPanel inner classes, ItemListPanel suppliers, and
  addSubspacePanel through the model. Override onDetach.
- ExplorePage: replace the three Model.of("back to " + findById().getLabel())
  snapshots with LoadableDetachableModel so back-link labels re-resolve.
- HomePage: route the lazy-loaded ViewList through a local
  LoadableDetachableModel<MaintainedResource>.

Refs #456.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…gleton fields

- WicketApplicationTest: assert the render strategy is REDIRECT_TO_BUFFER.
- SpacePageTest, MaintainedResourcePageTest: reflection-based architecture
  tests asserting the pages do not hold direct Space / MaintainedResource
  instance fields, and that the expected id + IModel fields are present.

These tests fail loudly if a future change reverts the structural fix
from #456 without re-thinking the form-state vs. singleton-freshness
trade-off.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tkuhn tkuhn marked this pull request as ready for review May 12, 2026 09:06
@tkuhn tkuhn merged commit 4cdb97a into master May 12, 2026
8 checks passed
@tkuhn tkuhn deleted the fix-f5-form-state-singleton-ldm branch May 12, 2026 09:12
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 4.27.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Browser refresh clears form values; underlying tension between page-instance preservation and singleton data freshness

1 participant