[JENKINS-75793] Fix inconsistent rendered values when using multiple reactiveChoice parameters#960
Open
baczus wants to merge 1 commit into
Open
[JENKINS-75793] Fix inconsistent rendered values when using multiple reactiveChoice parameters#960baczus wants to merge 1 commit into
baczus wants to merge 1 commit into
Conversation
…reactiveChoice parameters
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.
This PR fixes issue #902.
Root cause:
In the makeStaplerProxy2 function (introduced in v2.8.4 when PR #79 was reverted), the .then() handler inside the fetch call was missing return statements before response.json().then(...) and response.text().then(...). Without those returns, the outer await resolved as soon as the HTTP response headers arrived, before the response body was parsed and the callback was invoked. This broke the serialization of cascade parameter updates -- when rapidly changing env, the doUpdate and getChoicesForUI calls for chained parameters (stream, commit) could overlap, causing stale values (e.g., dev_commit1 showing up when prod was selected).
Fix:
Added return before both response.json().then(...) and response.text().then(...) in makeStaplerProxy2, so the promise chain properly propagates and await blocks until the callback completes.
Testing done
I tested the fix locally using the test job provided in the original issue, against the latest Jenkins LTS version.
Submitter checklist