Fix gift card customer select#6515
Conversation
Fixes `pnpm install` command failing due to not having PNPM installed Fix behavior of gift card customer selection
🦋 Changeset detectedLatest commit: d15c670 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 |
There was a problem hiding this comment.
Pull request overview
Adjusts the Gift Card “Customer” selector in the create dialog to avoid the previous buggy “type an email as an option” combobox behavior by introducing an explicit “use custom email” action.
Changes:
- Removes injecting typed custom-email entries into the
DynamicComboboxoptions list. - Adds derived
customEmailstate and renders a separate action button to select it. - Adds a changeset entry documenting the behavior change.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/giftCards/GiftCardCreateDialog/GiftCardCustomerSelectField.tsx | Refactors customer selection options and introduces a separate custom-email selection action. |
| .changeset/wacky-guests-joke.md | Adds a patch changeset describing the updated customer attachment behavior. |
| "saleor-dashboard": patch | ||
| --- | ||
|
|
||
| Changed behavior of Gift Card customer attachment, now it will show a separate button for custom value instead of buggy combobox |
There was a problem hiding this comment.
The changeset text reads a bit informal/unclear for a changelog entry (e.g., "buggy combobox"). Consider rephrasing as a concise, user-facing release note (and adding punctuation), describing that selecting a custom email for gift card customer is now done via a separate action/button.
| Changed behavior of Gift Card customer attachment, now it will show a separate button for custom value instead of buggy combobox | |
| Selecting a custom email for a gift card customer is now done using a separate button instead of the customer attachment combobox. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 3.22 #6515 +/- ##
=======================================
Coverage ? 43.55%
=======================================
Files ? 2585
Lines ? 45025
Branches ? 10550
=======================================
Hits ? 19611
Misses ? 25374
Partials ? 40 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| {customEmail && ( | ||
| <Box> | ||
| <Button | ||
| display="inline-block" | ||
| variant="tertiary" | ||
| onClick={() => { | ||
| setInputValue(customEmail); | ||
| setSelectedCustomer({ | ||
| email: customEmail, | ||
| name: customEmail, | ||
| }); | ||
| }} |
There was a problem hiding this comment.
The newly added "Use email" action remains clickable even when the field is disabled. This means users can still change selectedCustomer while the form is in a disabled/loading state. Pass the disabled prop through to the Button (or avoid rendering the action when disabled) to keep behavior consistent with the combobox.
| const customEmail = useMemo((): string | null => { | ||
| const trimmedCustomValue = inputValue.trim(); | ||
|
|
||
| if (!hasExactMatch) { | ||
| opts.unshift({ | ||
| label: `${intl.formatMessage(messages.useEmail)} ${trimmed}`, | ||
| value: trimmed, | ||
| }); | ||
| } | ||
| if ( | ||
| selectedCustomer.email && |
There was a problem hiding this comment.
The newly introduced customEmail derivation is not covered by tests. Add a component-level test that types a valid, non-matching email and asserts the separate "Use email" action appears, then click it and assert it updates the selected customer and the action disappears.
Port of #6513