Skip to content

Fix gift card customer select#6513

Merged
lkostrowski merged 7 commits into
mainfrom
lkostrowski/fix-email-dropdown-update
Apr 16, 2026
Merged

Fix gift card customer select#6513
lkostrowski merged 7 commits into
mainfrom
lkostrowski/fix-email-dropdown-update

Conversation

@lkostrowski
Copy link
Copy Markdown
Member

Scope of the change

  • I confirm I added ripples for changes (see src/ripples) or my feature doesn't contain any user-facing changes
  • I used analytics "trackEvent" for important events

Copilot AI review requested due to automatic review settings April 15, 2026 11:24
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 15, 2026

🦋 Changeset detected

Latest commit: d801c97

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
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 3.44828% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.93%. Comparing base (01c6fca) to head (d801c97).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ftCardCreateDialog/GiftCardCustomerSelectField.tsx 3.44% 24 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6513      +/-   ##
==========================================
- Coverage   47.94%   47.93%   -0.02%     
==========================================
  Files        2579     2579              
  Lines       45736    45748      +12     
  Branches    10787    10796       +9     
==========================================
  Hits        21928    21928              
- Misses      22560    22571      +11     
- Partials     1248     1249       +1     
Flag Coverage Δ
storybook 43.04% <ø> (ø)
units 43.71% <3.44%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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
Copy Markdown
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

Fixes behavior of the gift card “Customer” combobox so the selected customer is cleared when the user edits the input after making a selection, and adds unit tests around the customer/email selection behavior.

Changes:

  • Clear selectedCustomer when the combobox input changes away from the selected value.
  • Add RTL tests covering rendering, “Use email” option, selection, and post-selection editing behavior.

Reviewed changes

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

File Description
src/giftCards/GiftCardCreateDialog/GiftCardCustomerSelectField.tsx Adds logic to clear the selected customer when the input value changes.
src/giftCards/GiftCardCreateDialog/GiftCardCustomerSelectField.test.tsx Adds component-level tests and mocks for search/debounce behavior.

Comment on lines +104 to +110
onInputValueChange={val => {
setInputValue(val);
debouncedSearch(val);

if (selectedCustomer.email && val !== selectedCustomer.email) {
setSelectedCustomer({ email: "", name: "" });
}
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The new clearing condition compares the combobox input value only to selectedCustomer.email. DynamicCombobox typically updates the input to the selected option’s label (e.g. full name or "Use email: …"), so after selecting a customer the next onInputValueChange may see val === selectedCustomer.name but val !== selectedCustomer.email and immediately clear the selection again (potentially even on initial render when a value is set). Consider treating both the selected email and the selected label as valid input values (or otherwise distinguishing user typing from selection updates) before clearing selectedCustomer.

Copilot uses AI. Check for mistakes.
Comment thread src/giftCards/GiftCardCreateDialog/GiftCardCustomerSelectField.test.tsx Outdated
Comment thread src/giftCards/GiftCardCreateDialog/GiftCardCustomerSelectField.test.tsx Outdated
Fixes `pnpm install` command failing due to not having PNPM installed

Fix behavior of gift card customer selection
@lkostrowski lkostrowski force-pushed the lkostrowski/fix-email-dropdown-update branch from c7cfaef to 9394eb1 Compare April 15, 2026 12:53
@lkostrowski lkostrowski marked this pull request as ready for review April 15, 2026 12:54
@lkostrowski lkostrowski requested a review from a team as a code owner April 15, 2026 12:54
Copy link
Copy Markdown
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 2 out of 4 changed files in this pull request and generated 4 comments.

Comment thread src/giftCards/GiftCardCreateDialog/GiftCardCustomerSelectField.tsx Outdated
});
}}
>
Use custom email: {customEmail}
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The button text "Use custom email: …" is a new user-facing string but it isn’t localized. Please use react-intl (e.g. reuse messages.useEmail or add a new message descriptor) so this label is translated consistently with the rest of the gift card create dialog.

Suggested change
Use custom email: {customEmail}
{intl.formatMessage(
{
defaultMessage: "Use custom email: {email}",
id: "I4TjC5",
},
{ email: customEmail },
)}

Copilot uses AI. Check for mistakes.
Comment thread src/giftCards/GiftCardCreateDialog/GiftCardCustomerSelectField.tsx Outdated
Comment on lines +136 to +152
{customEmail && (
<Box>
<Button
display="inline-block"
variant="tertiary"
onClick={() => {
setInputValue(customEmail);
setSelectedCustomer({
email: customEmail,
name: customEmail,
});
}}
>
Use custom email: {customEmail}
</Button>
</Box>
)}
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

This change introduces new UI state/behavior (showing a separate “custom email” action and selecting it). Consider adding a component-level test that covers: (1) button appears only for a valid, non-matching email; (2) clicking it updates selectedCustomer and hides the button when it matches the selection.

Copilot uses AI. Check for mistakes.
lkostrowski and others added 3 commits April 15, 2026 14:58
…leor/saleor-dashboard into lkostrowski/fix-email-dropdown-update
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 15, 2026 12:59
Copy link
Copy Markdown
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 2 out of 4 changed files in this pull request and generated 2 comments.

Comment on lines +136 to +147
{customEmail && (
<Box>
<Button
display="inline-block"
variant="tertiary"
onClick={() => {
setInputValue(customEmail);
setSelectedCustomer({
email: customEmail,
name: customEmail,
});
}}
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The combobox respects the disabled prop, but the new "Use email" button remains clickable and can still mutate selectedCustomer while the field is disabled. Pass disabled={disabled} to the Button (and/or hide the button when disabled) to keep the disabled state consistent.

Copilot uses AI. Check for mistakes.
Comment thread .changeset/wacky-guests-joke.md Outdated
peelar
peelar previously approved these changes Apr 16, 2026
@lkostrowski lkostrowski enabled auto-merge (squash) April 16, 2026 09:29
@lkostrowski lkostrowski disabled auto-merge April 16, 2026 10:12
@lkostrowski lkostrowski enabled auto-merge (squash) April 16, 2026 10:12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 16, 2026 10:12
@lkostrowski lkostrowski merged commit 100df98 into main Apr 16, 2026
17 of 20 checks passed
@lkostrowski lkostrowski deleted the lkostrowski/fix-email-dropdown-update branch April 16, 2026 10:16
Copy link
Copy Markdown
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 2 out of 4 changed files in this pull request and generated 1 comment.

Comment on lines +136 to +151
{customEmail && (
<Box>
<Button
display="inline-block"
variant="tertiary"
onClick={() => {
setInputValue(customEmail);
setSelectedCustomer({
email: customEmail,
name: customEmail,
});
}}
>
{intl.formatMessage(messages.useEmail)} {customEmail}
</Button>
</Box>
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The disabled prop disables the combobox, but the custom email Button remains clickable. If this field can become disabled after a user typed a value (or if it renders with customEmail already computed), clicking the button would still change selectedCustomer while the UI is supposed to be read-only. Pass disabled={disabled} to the Button (and/or avoid rendering the custom-email action when disabled is true).

Copilot uses AI. Check for mistakes.
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.

3 participants