Skip to content

Commit

Permalink
Fix display when label doesn't match search term
Browse files Browse the repository at this point in the history
  • Loading branch information
StephixOne authored and pKorsholm committed May 16, 2023
1 parent 82f36e8 commit 945dd53
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,16 @@ const ItemSearch = ({ onItemSelect, clearOnSelect, filters = {} }: Props) => {
}

const options = inventory_items?.map((inventoryItem) => ({
label: inventoryItem.title || undefined,
label:
inventoryItem.title ||
inventoryItem.variants[0].product.title ||
inventoryItem.sku,
value: inventoryItem.id,
inventoryItem,
})) as ItemOption[]

const filterOptions = () => true

return (
<div>
<NextSelect
Expand All @@ -69,16 +74,13 @@ const ItemSearch = ({ onItemSelect, clearOnSelect, filters = {} }: Props) => {
onChange={onChange}
value={null}
isLoading={queryEnabled && isLoading}
filterOption={filterOptions} // TODO: Remove this when we can q for inventory item titles
/>
</div>
)
}

const ProductOption = ({
innerProps,
isDisabled,
data,
}: OptionProps<ItemOption>) => {
const ProductOption = ({ innerProps, data }: OptionProps<ItemOption>) => {
const { available, inStock } = React.useMemo(() => {
return (data.inventoryItem.location_levels || []).reduce(
(acc, curr) => {
Expand Down

0 comments on commit 945dd53

Please sign in to comment.