[JENKINS-76249] Fix form submission when a dropdown changes and the back end response is slow#26161
Merged
MarkEWaite merged 4 commits intojenkinsci:masterfrom Jan 24, 2026
Merged
Conversation
jtnord
commented
Jan 22, 2026
…eb response is slow calling renderOnDemand can cause the dom to be manipulated aynchronouslyi due to function calls going to the Jenkins server (e.g. stapler/bound/xxx/render). When this occurs if there is a subsequent change to the dropdown selection before this completes, when the HTML is finally obtained from Jenkins it is inserted into the DOM, but it is inserted as if it is still the selected option (ie it is not disable for the form). renderOnDemand takes a callback function that will be called when the DOM manipulation is complete, however the updateDropDownList did not pass any function. We now pass a function that manipulates the just added HTML if the selected item is in fact no longer selected.
jtnord
commented
Jan 23, 2026
Comment on lines
+1719
to
+1721
| // our form div has changed (but the index is stable) so go and re-get the new domtree | ||
| var subForm = buildSubForms(e)[idx]; | ||
| updateDropDownFormRowVisibility(subForm, false); |
Member
Author
There was a problem hiding this comment.
for testing these 3 lines where commented out to show the previous console line was printed and the test failed ~ 1:10
Then re introduced and the test passed 100 times in a row
timja
reviewed
Jan 23, 2026
timja
reviewed
Jan 23, 2026
timja
reviewed
Jan 23, 2026
Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
janfaracik
approved these changes
Jan 23, 2026
Member
|
/label ready-for-merge This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback. Thanks! |
StefanSpieker
approved these changes
Jan 23, 2026
shalinisudarsan
pushed a commit
to shalinisudarsan/jenkins
that referenced
this pull request
Jan 29, 2026
…ack end response is slow (jenkinsci#26161) * [JENKINS-76249] Fix form submission when a dropdown changes and the web response is slow calling renderOnDemand can cause the dom to be manipulated aynchronouslyi due to function calls going to the Jenkins server (e.g. stapler/bound/xxx/render). When this occurs if there is a subsequent change to the dropdown selection before this completes, when the HTML is finally obtained from Jenkins it is inserted into the DOM, but it is inserted as if it is still the selected option (ie it is not disable for the form). renderOnDemand takes a callback function that will be called when the DOM manipulation is complete, however the updateDropDownList did not pass any function. We now pass a function that manipulates the just added HTML if the selected item is in fact no longer selected. * Update war/src/main/webapp/scripts/hudson-behavior.js Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> --------- Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> (cherry picked from commit 46a0a75)
shalinisudarsan
pushed a commit
to shalinisudarsan/jenkins
that referenced
this pull request
Jan 29, 2026
…ack end response is slow (jenkinsci#26161) * [JENKINS-76249] Fix form submission when a dropdown changes and the web response is slow calling renderOnDemand can cause the dom to be manipulated aynchronouslyi due to function calls going to the Jenkins server (e.g. stapler/bound/xxx/render). When this occurs if there is a subsequent change to the dropdown selection before this completes, when the HTML is finally obtained from Jenkins it is inserted into the DOM, but it is inserted as if it is still the selected option (ie it is not disable for the form). renderOnDemand takes a callback function that will be called when the DOM manipulation is complete, however the updateDropDownList did not pass any function. We now pass a function that manipulates the just added HTML if the selected item is in fact no longer selected. * Update war/src/main/webapp/scripts/hudson-behavior.js Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> --------- Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> (cherry picked from commit 46a0a75)
shalinisudarsan
pushed a commit
to shalinisudarsan/jenkins
that referenced
this pull request
Jan 29, 2026
…ack end response is slow (jenkinsci#26161) * [JENKINS-76249] Fix form submission when a dropdown changes and the web response is slow calling renderOnDemand can cause the dom to be manipulated aynchronouslyi due to function calls going to the Jenkins server (e.g. stapler/bound/xxx/render). When this occurs if there is a subsequent change to the dropdown selection before this completes, when the HTML is finally obtained from Jenkins it is inserted into the DOM, but it is inserted as if it is still the selected option (ie it is not disable for the form). renderOnDemand takes a callback function that will be called when the DOM manipulation is complete, however the updateDropDownList did not pass any function. We now pass a function that manipulates the just added HTML if the selected item is in fact no longer selected. * Update war/src/main/webapp/scripts/hudson-behavior.js Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> --------- Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> (cherry picked from commit 46a0a75)
meetgoti07
pushed a commit
to meetgoti07/jenkins
that referenced
this pull request
Jan 29, 2026
…ack end response is slow (jenkinsci#26161) * [JENKINS-76249] Fix form submission when a dropdown changes and the web response is slow calling renderOnDemand can cause the dom to be manipulated aynchronouslyi due to function calls going to the Jenkins server (e.g. stapler/bound/xxx/render). When this occurs if there is a subsequent change to the dropdown selection before this completes, when the HTML is finally obtained from Jenkins it is inserted into the DOM, but it is inserted as if it is still the selected option (ie it is not disable for the form). renderOnDemand takes a callback function that will be called when the DOM manipulation is complete, however the updateDropDownList did not pass any function. We now pass a function that manipulates the just added HTML if the selected item is in fact no longer selected. * Update war/src/main/webapp/scripts/hudson-behavior.js Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> --------- Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
shalinisudarsan
pushed a commit
to shalinisudarsan/jenkins
that referenced
this pull request
Jan 30, 2026
…ack end response is slow (jenkinsci#26161) * [JENKINS-76249] Fix form submission when a dropdown changes and the web response is slow calling renderOnDemand can cause the dom to be manipulated aynchronouslyi due to function calls going to the Jenkins server (e.g. stapler/bound/xxx/render). When this occurs if there is a subsequent change to the dropdown selection before this completes, when the HTML is finally obtained from Jenkins it is inserted into the DOM, but it is inserted as if it is still the selected option (ie it is not disable for the form). renderOnDemand takes a callback function that will be called when the DOM manipulation is complete, however the updateDropDownList did not pass any function. We now pass a function that manipulates the just added HTML if the selected item is in fact no longer selected. * Update war/src/main/webapp/scripts/hudson-behavior.js Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> --------- Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com> (cherry picked from commit 46a0a75)
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.
calling
renderOnDemandcan cause the DOM to be manipulated aynchronously due to function calls going to the Jenkins server (e.g.stapler/bound/xxx/render). When this occurs if there is a subsequent change to the dropdown selection before this completes, when the HTML is finally obtained from Jenkins it is inserted into the DOM, but it is inserted as if it is still the selected option (ie it is not disable for the form).renderOnDemandtakes a callback function that will be called when the DOM manipulation is complete, however theupdateDropDownListdid not pass any function.We now pass a function that manipulates the just added HTML if the selected item is in fact no longer selected.
Fixes #16833
Testing done
jenkins/war/src/main/webapp/scripts/hudson-behavior.js
Lines 1719 to 1721 in 03eaf02
mvn test -Dtest=SshSlavesPluginTest#newAgentin a loop.Observed that the test failed ~ 1 time in 10 and that the newly added console log (
**** renderOnDemandCallback, selection no longer valid, form submission would have been corrupted) always appeared when the test would fail (and very rarely appeared otherwise)mvn test -Dtest=SshSlavesPluginTest#newAgentagain.Observed I still see the newly introduced console log ~ 1 time in 10m but the test did not fail in > 800 runs.
Screenshots (UI changes only)
Before
After
Proposed changelog entries
Got type array but no lister class found for type...)Proposed changelog category
/label
Proposed upgrade guidelines
N/A
Submitter checklist
@Restrictedor have@since TODOJavadocs, as appropriate.@Deprecated(since = "TODO")or@Deprecated(forRemoval = true, since = "TODO"), if applicable.evalto ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
@mention
Before the changes are marked as
ready-for-merge:Maintainer checklist
upgrade-guide-neededlabel is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidateto be considered.