Skip to content

Comments

Add create new option, add query for missing elements in combobobx#6278

Merged
witoszekdev merged 10 commits intomainfrom
fix-combobox-search
Jan 27, 2026
Merged

Add create new option, add query for missing elements in combobobx#6278
witoszekdev merged 10 commits intomainfrom
fix-combobox-search

Conversation

@witoszekdev
Copy link
Member

@witoszekdev witoszekdev commented Jan 26, 2026

This PR adds "Add new value: " to combobox in Attribute selection. New attributes (like previous component) are created once page is saved.

New values are fetched when user enters new text into the combobox, since we only fetch 20 items on first focus (also in previous component).

Copilot AI review requested due to automatic review settings January 26, 2026 17:36
@changeset-bot
Copy link

changeset-bot bot commented Jan 26, 2026

🦋 Changeset detected

Latest commit: 6ed2736

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

❌ Patch coverage is 83.54430% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.63%. Comparing base (944569d) to head (6ed2736).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/components/Attributes/DropdownRow.tsx 73.52% 8 Missing and 1 partial ⚠️
src/components/Attributes/SwatchRow.tsx 20.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6278      +/-   ##
==========================================
+ Coverage   42.54%   42.63%   +0.08%     
==========================================
  Files        2486     2488       +2     
  Lines       42944    43005      +61     
  Branches     9685     9696      +11     
==========================================
+ Hits        18271    18334      +63     
+ Misses      24638    24635       -3     
- Partials       35       36       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “create new value” behavior and improved querying to attribute comboboxes, and updates how dropdown attribute values are serialized in the attributes input payload.

Changes:

  • Introduces a new DropdownRow component for dropdown attributes with custom “Add new value” option and debounced querying.
  • Updates SwatchRow to use shared combobox handlers and to support query-on-input plus fetch-more.
  • Changes dropdown attribute input serialization to use a dropdown: { value } | null shape and updates tests accordingly.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/components/Attributes/useAttributeDropdown.ts New hook to handle dropdown combobox fetching + custom option label/option creation.
src/components/Attributes/SwatchRow.tsx Adds debounced querying, standardized focus/scroll handlers, and loading indicator wiring.
src/components/Attributes/DropdownRow.tsx New dropdown attribute row component with “Add new value” option handling.
src/components/Attributes/AttributeRow.tsx Refactors DROPDOWN rendering to use DropdownRow.
src/attributes/utils/handlers.ts Serializes DROPDOWN attributes using dropdown field instead of values.
src/attributes/utils/handlers.test.ts Updates expectations for the new dropdown input shape and changed-attribute behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +39 to +46
const [selectedValue, setSelectedValue] = useState<Option | null>(
attribute.value[0]
? {
value: attribute.value[0],
label: getSingleDisplayValue(attribute, attributeValues),
}
: null,
);
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selectedValue is initialized from attribute.value/attributeValues once, but it won’t update if the parent changes attribute.value (e.g. form reset, external update, attributeValues fetched later). This can leave the combobox showing a stale selection. Prefer deriving value directly from props each render, or add an effect to sync selectedValue when attribute.value[0] / attributeValues change.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings January 27, 2026 15:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

witoszekdev and others added 2 commits January 27, 2026 17:55
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 27, 2026 16:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 27, 2026 17:12
@witoszekdev witoszekdev marked this pull request as ready for review January 27, 2026 17:13
@witoszekdev witoszekdev requested a review from a team as a code owner January 27, 2026 17:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@witoszekdev witoszekdev merged commit 21eacd7 into main Jan 27, 2026
24 of 27 checks passed
@witoszekdev witoszekdev deleted the fix-combobox-search branch January 27, 2026 20:14
This was referenced Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants