[go: nahoru, domu]

Skip to content

Commit

Permalink
Product Editor: Fix crash when uploading files from variations list Q…
Browse files Browse the repository at this point in the history
…uick Update menu (#45748)

* Handle when downloads menu is passed an empty selection

* Changelog
  • Loading branch information
mattsherman committed Mar 20, 2024
1 parent 87bfa48 commit 4272a78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Product Editor: "Upload files" quick update menu for variations does not crash variations list.
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down

0 comments on commit 4272a78

Please sign in to comment.