Repository navigation
[4.1.x] Save valid and localValueSet of UIInput with its local value again - #1130
Merged
Merged
Conversation
Since 4e2bf73, valid and localValueSet were held in the TransientStateHelper, while the local value they qualify stayed in the saved StateHelper. An input which got a local value but never reached updateModel, because its parent turned rendered=false during the same Update Model Values walk, then kept that local value with the flag dropped. Every later updateModel bailed on !isLocalValueSet(), and the input rendered the stale local value forever. Save both flags in the StateHelper again, as in 4.1.3, and restore their INITIAL_STATE_PROPERTIES entries so that a flag back at its default leaves the delta. submittedValue stays transient. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
asf-gitbox-commits
pushed a commit
that referenced
this pull request
Nov 4, 2026
…1130) Since 4e2bf73, valid and localValueSet were held in the TransientStateHelper, while the local value they qualify stayed in the saved StateHelper. An input which got a local value but never reached updateModel, because its parent turned rendered=false during the same Update Model Values walk, then kept that local value with the flag dropped. Every later updateModel bailed on !isLocalValueSet(), and the input rendered the stale local value forever. Save both flags in the StateHelper again, as in 4.1.3, and restore their INITIAL_STATE_PROPERTIES entries so that a flag back at its default leaves the delta. submittedValue stays transient. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
While comparing the view state of Mojarra and MyFaces, the saved state of an input turned out to hold its local value, but no longer the
validandlocalValueSetflags which belong to it. This makes an input render a stale value forever.This PR targets
4.1.x. The same change is needed onmain, which has the same commit (3ca891b). Please upmerge or cherry-pick it intomainyourselves.Problem
Since 4.1.4, an input can keep rendering a stale local value forever, while a readonly input bound to the same property follows the model. Reproducer:
Select "Show", click "Increment" twice, select "Hide" and then "Show" again, and click "Increment" twice. The value of each input after each step, editable first:
MyFaces 4.1.4 gives the same result with server and with client side state saving.
Cause
The "Hide" request executes
@formwhile the group is still rendered, so the editable input gets a local value. During Update Model Values the menu setsrenderedtofalsebefore the walk reaches the group, so the input never reachesupdateModel(), which would clear the local value. The local value is saved in theStateHelper, but since 3ca891b onmainand 4e2bf73 on4.1.x("[perf] use and optimize TransientStateHelper, …")validandlocalValueSetare held in theTransientStateHelper, and that is not saved during Render Response. On every later request,updateModel()stops at!isLocalValueSet(), never clears the local value, andgetValue()keeps returning it before it evaluates the value expression.Change
isValid(),setValid(),isLocalValueSet()andsetLocalValueSet()use theStateHelperagain, with the same bodies as in 4.1.3, andlocalValueSetandvalidare back inINITIAL_STATE_PROPERTIES. A default value is still not written when the component has no entry for it yet, so an input at its defaults adds nothing to the saved state.submittedValuestays in theTransientStateHelper. It is per-request state. 4.1.3 did save it, so this is the one difference to 4.1.3 which remains.Two comments in
EditableValueHolderStatedescribedvalidandlocalValueSetas transient state, and are updated accordingly.This gives back part of the speed gain of the perf commit: setting
validorlocalValueSetis aStateHelperput again, also per row of aUIDataorUIRepeat. The saved state does not grow from it, because a value which is back at its default is removed from the delta before saving.The new
UIInputPSSTestsaves and restores the state during Render Response, as for the view state, because outside that phaseUIComponentBase.saveState()also saves the transient state. Without the change inUIInput, two of its tests fail. Without the re-addedINITIAL_STATE_PROPERTIESentries, two of its tests fail as well. The fullapiandimplbuilds pass.Mojarra made the same change in 4.0.19 and 4.1.10, got the same report in eclipse-ee4j/mojarra#6019, and fixed it the same way in eclipse-ee4j/mojarra#6021.
🤖 Generated with Claude Opus 5.5