-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[JENKINS-76249] Fix form submission when a dropdown changes and the back end response is slow #26161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…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.
| // 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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Co-authored-by: Tim Jacomb <[email protected]>
Co-authored-by: Tim Jacomb <[email protected]>
timja
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
|
/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! |
A1exKH
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
…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 <[email protected]> * Apply suggestions from code review Co-authored-by: Tim Jacomb <[email protected]> --------- Co-authored-by: Tim Jacomb <[email protected]> (cherry picked from commit 46a0a75)
…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 <[email protected]> * Apply suggestions from code review Co-authored-by: Tim Jacomb <[email protected]> --------- Co-authored-by: Tim Jacomb <[email protected]> (cherry picked from commit 46a0a75)
…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 <[email protected]> * Apply suggestions from code review Co-authored-by: Tim Jacomb <[email protected]> --------- Co-authored-by: Tim Jacomb <[email protected]> (cherry picked from commit 46a0a75)
…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 <[email protected]> * Apply suggestions from code review Co-authored-by: Tim Jacomb <[email protected]> --------- Co-authored-by: Tim Jacomb <[email protected]>
…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 <[email protected]> * Apply suggestions from code review Co-authored-by: Tim Jacomb <[email protected]> --------- Co-authored-by: Tim Jacomb <[email protected]> (cherry picked from commit 46a0a75)
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.