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 => {
8181 selectedConfigurableOptions . length &&
8282 selectedConfigurableOptions . length === configurableOptions . length
8383 ) {
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 => {
8786 const {
8887 id : attributeId ,
8988 value_id : selectedValueId
9089 } = selectedOption ;
9190 const configurableOption = configurableOptions . find (
9291 option => option . attribute_id_v2 === attributeId
9392 ) ;
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 ) ;
102109
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+ }
106117 }
107118
108119 return item ;
You can’t perform that action at this time.
0 commit comments