Keep query-based dropdown empty after clicking clear - #7798
amirshahzadhashmi7145 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="client/app/components/QueryBasedParameterInput.jsx">
<violation number="1" location="client/app/components/QueryBasedParameterInput.jsx:56">
P2: When a dropdown query contains an option with an empty-string value, this branch clears it before the option lookup, so the option cannot be selected or restored. Treat only nullish values as the clear state, since empty strings are supported option values.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| value = found ? value : get(first(options), "value"); | ||
| this.setState({ value }); | ||
| return value; | ||
| if (value == null || value === "") { |
There was a problem hiding this comment.
P2: When a dropdown query contains an option with an empty-string value, this branch clears it before the option lookup, so the option cannot be selected or restored. Treat only nullish values as the clear state, since empty strings are supported option values.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client/app/components/QueryBasedParameterInput.jsx, line 56:
<comment>When a dropdown query contains an option with an empty-string value, this branch clears it before the option lookup, so the option cannot be selected or restored. Treat only nullish values as the clear state, since empty strings are supported option values.</comment>
<file context>
@@ -53,10 +53,14 @@ export default class QueryBasedParameterInput extends React.Component {
- value = found ? value : get(first(options), "value");
- this.setState({ value });
- return value;
+ if (value == null || value === "") {
+ this.setState({ value: undefined });
+ return null;
</file context>
| if (value == null || value === "") { | |
| if (value == null) { |
Greptile SummaryThe PR preserves an explicitly cleared query-based dropdown instead of automatically selecting its first option again.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| client/app/components/QueryBasedParameterInput.jsx | Adds empty-value handling before the existing option validation and first-option fallback; no eligible follow-up defect was identified. |
Reviews (3): Last reviewed commit: "Keep query-based dropdown empty after cl..." | Re-trigger Greptile
|
I think it is easier to review if the diff for PR is minimum. |
|
Thanks for the feedback — I've reduced the diff to the minimum needed for the fix: a 4-line early return in `setValue` when the value is cleared, with no other logic changes. Rebased onto latest `master` as well. |
aca81df to
5ccecac
Compare
Clearing used to fall back to the first option in the UI even though the parameter value was empty. Co-authored-by: Cursor <cursoragent@cursor.com>
5ccecac to
8e57299
Compare
Summary
Test plan