Skip to content

Commit

Permalink
Fix: Moving the last page item to the the trash causes a crash. (#65236)
Browse files Browse the repository at this point in the history
co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
  • Loading branch information
4 people authored Sep 11, 2024
1 parent a15a93d commit 8a7df39
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/dataviews/src/dataviews-layouts/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ export default function ViewList< Item >( props: ViewListProps< Item > ) {
data.length - 1,
Math.max( 0, targetIndex )
);
if ( ! data[ clampedIndex ] ) {
return;
}
const itemIdPrefix = generateCompositeItemIdPrefix(
data[ clampedIndex ]
);
Expand Down

0 comments on commit 8a7df39

Please sign in to comment.