Product Editor: Fix crash when uploading files from variations list Quick Update menu (#45748)
* Handle when downloads menu is passed an empty selection * Changelog
This commit is contained in:
parent
87bfa48638
commit
4272a782a6
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Product Editor: "Upload files" quick update menu for variations does not crash variations list.
|
|
@ -33,9 +33,12 @@ export function DownloadsMenuItem( {
|
|||
}: VariationActionsMenuItemProps ) {
|
||||
const ids = selection.map( ( { id } ) => id );
|
||||
|
||||
const downloadsIds: number[] = selection[ 0 ].downloads.map(
|
||||
( { id }: ProductDownload ) => Number.parseInt( id, 10 )
|
||||
);
|
||||
const downloadsIds: number[] =
|
||||
selection?.length > 0
|
||||
? selection[ 0 ].downloads.map( ( { id }: ProductDownload ) =>
|
||||
Number.parseInt( id, 10 )
|
||||
)
|
||||
: [];
|
||||
|
||||
const [ uploadFilesModalOpen, setUploadFilesModalOpen ] = useState( false );
|
||||
|
||||
|
|
Loading…
Reference in New Issue