feat(aci): Add ability to create envs inline#112558
Merged
saponifi3d merged 4 commits intomasterfrom Apr 9, 2026
Merged
Conversation
malwilley
approved these changes
Apr 9, 2026
Comment on lines
+51
to
55
| onCreateOption={env => { | ||
| setNewEnvironment(env); | ||
| formContext.form?.setValue(ENV_FIELD_NAME, env); | ||
| }} | ||
| {...props} |
Contributor
There was a problem hiding this comment.
Bug: The internal onCreateOption handler is placed before {...props}, so a caller-provided onCreateOption will override it, preventing new options from being saved.
Severity: MEDIUM
Suggested Fix
Move the component's props, including the internal onCreateOption handler, to be defined after the {...props} spread. This ensures the internal logic is preserved and can be extended by chaining any caller-provided onCreateOption function if needed.
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:
static/app/views/detectors/components/forms/common/environmentField.tsx#L51-L55
Potential issue: In the `EnvironmentField` component, the internal `onCreateOption`
handler is defined before the `{...props}` spread. This means any `onCreateOption` prop
passed by a parent component will silently override the internal logic. The internal
handler is responsible for adding newly created environment options to the dropdown
choices and updating the form's state. When this handler is overridden, these actions do
not occur, and the newly created option is effectively lost, not being reflected in the
UI or the form data.
Did we get this right? 👍 / 👎 to inform future reviews.
george-sentry
pushed a commit
that referenced
this pull request
Apr 9, 2026
# Description Updated the environment selector to be able to create a new environment inline. Right now, we can only select environments on Uptime and Metric monitors. The Metric monitor will be able to save the new environments after #112537 is deployed. ### Metric Monitor <img width="1624" height="1061" alt="Screenshot 2026-04-08 at 4 56 33 PM" src="https://github.com/user-attachments/assets/f6c2ebef-3b2c-45fe-bc29-839c4be81f35" /> ### Uptime Monitor <img width="1624" height="1061" alt="Screenshot 2026-04-08 at 4 58 48 PM" src="https://github.com/user-attachments/assets/09b61794-3242-48ee-8f03-d3b0ecc05060" /> ### Uptime Saves <img width="1624" height="1061" alt="Screenshot 2026-04-08 at 4 59 33 PM" src="https://github.com/user-attachments/assets/5783da6b-a7f7-4e07-b501-eb7eebcab22f" />
3 tasks
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.
Description
Updated the environment selector to be able to create a new environment inline.
Right now, we can only select environments on Uptime and Metric monitors. The Metric monitor will be able to save the new environments after #112537 is deployed.
Metric Monitor
Uptime Monitor
Uptime Saves