File tree Expand file tree Collapse file tree 1 file changed +25
-14
lines changed
packages/peregrine/lib/talons/WishlistPage Expand file tree Collapse file tree 1 file changed +25
-14
lines changed Original file line number Diff line number Diff line change @@ -81,28 +81,39 @@ export const useWishlistItem = props => {
81
81
selectedConfigurableOptions . length &&
82
82
selectedConfigurableOptions . length === configurableOptions . length
83
83
) {
84
- const selectedOptionsArray = selectedConfigurableOptions . map (
85
- selectedOption => {
86
- // TODO: Use configurable_product_option_uid for ConfigurableWishlistItem when available in 2.4.5
84
+ const selectedOptionsArray = selectedConfigurableOptions
85
+ . map ( selectedOption => {
87
86
const {
88
87
id : attributeId ,
89
88
value_id : selectedValueId
90
89
} = selectedOption ;
91
90
const configurableOption = configurableOptions . find (
92
91
option => option . attribute_id_v2 === attributeId
93
92
) ;
94
- const configurableOptionValue = configurableOption . values . find (
95
- optionValue =>
96
- optionValue . value_index === selectedValueId
97
- ) ;
98
-
99
- return configurableOptionValue . uid ;
100
- }
101
- ) ;
93
+ if ( configurableOption ) {
94
+ const configurableOptionValue = configurableOption . values . find (
95
+ optionValue =>
96
+ optionValue . value_index === selectedValueId
97
+ ) ;
98
+
99
+ if (
100
+ configurableOptionValue &&
101
+ configurableOptionValue . uid
102
+ ) {
103
+ return configurableOptionValue . uid ;
104
+ }
105
+ }
106
+ return null ;
107
+ } )
108
+ . filter ( uid => uid !== null ) ;
102
109
103
- Object . assign ( item , {
104
- selected_options : selectedOptionsArray
105
- } ) ;
110
+ if ( selectedOptionsArray . length > 0 ) {
111
+ Object . assign ( item , {
112
+ selected_options : selectedOptionsArray
113
+ } ) ;
114
+ } else {
115
+ return null ;
116
+ }
106
117
}
107
118
108
119
return item ;
You can’t perform that action at this time.
0 commit comments