Release 1.143.5#3434
Closed
odlbot wants to merge 10 commits into
Closed
Conversation
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…#3412) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: feoh <330070+feoh@users.noreply.github.com>
…rollment for a program (#3430)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
OpenAPI ChangesShow/hide ## Changes for v0.yaml:Unexpected changes? Ensure your branch is up-to-date with |
Comment on lines
+135
to
+142
| toggleUpgradeDialogVisibility = async () => { | ||
| const { upgradeEnrollmentDialogVisibility } = this.state | ||
| const { programs, createProgramEnrollment } = this.props | ||
|
|
||
| this.setState({ | ||
| upgradeEnrollmentDialogVisibility: !upgradeEnrollmentDialogVisibility | ||
| }) | ||
| try { |
There was a problem hiding this comment.
Bug: The toggleUpgradeDialogVisibility function is called on modal dismissal, but it also unconditionally calls createProgramEnrollment, creating an enrollment when the user intends to cancel.
Severity: HIGH
Suggested Fix
Separate the logic for toggling the modal's visibility from the enrollment creation. The toggleUpgradeDialogVisibility function should only manage the modal's state. The createProgramEnrollment call should be moved to a new, separate function that is triggered only by an explicit user action, such as clicking a confirmation button within the modal.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: frontend/public/src/components/ProgramProductDetailEnroll.js#L135-L142
Potential issue: The `toggleUpgradeDialogVisibility` function is bound to the modal's
`toggle` prop. This means it executes not only when the modal is opened, but also when
it's dismissed by clicking the 'X' button, pressing the ESC key, or clicking the
backdrop. The function's logic unconditionally calls `createProgramEnrollment`, which
makes a `POST` request to create a new program enrollment. As a result, an enrollment is
created every time a user closes the dialog, which is contrary to their intent and leads
to unintended data creation.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
Muhammad Arslan
annagav
James Kachel
Tobias Macey
cp-at-mit
renovate[bot]