fix: restore F5 form-state preservation via singleton LDMs (#456)#457
Merged
Conversation
… 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>
|
🎉 This PR is included in version 4.27.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ONE_PASS_RENDER(introduced in Instances sometimes get slow and eventually unresponsive after a while #401) so Wicket falls back to its defaultREDIRECT_TO_BUFFERstrategy — F5 restores the stored page instance, which preserves partly-filled form values onPublishPage,GenPublishPage, and the connector forms.SpacePageandMaintainedResourcePage; wrap theSpace/MaintainedResourcein aLoadableDetachableModelso restored pages re-fetch the live singleton instead of rendering from a serialized snapshot.AjaxLazyLoadPanelinner classes,ItemListPanelsuppliers, andaddSubspacePanelthrough the model; overrideonDetach().Model.of(\"back to \" + findById().getLabel())snapshots inExplorePagewithLoadableDetachableModel.HomePage's lazy-loadedViewListpath in aLoadableDetachableModel.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 compilepassesmvn -o testpasses (682 tests, 0 failures)/publish?template=..., partly fill the form, press F5 — values are restored/explore?id=<term>&context=<spaceId|resourceId|userId>— the "back to ..." link shows the current label/— home resource views load both fast-path and via the lazy loader🤖 Generated with Claude Code