Teact: Fix re-ordering children without teactOrderKey

This commit is contained in:
Alexander Zinchuk 2023-05-15 10:56:14 +02:00
parent da4e5e543b
commit cd078bcd33

View File

@ -517,7 +517,7 @@ function renderFastListChildren($current: VirtualElementParent, $new: VirtualEle
const newOrderKey = 'props' in $newChild ? $newChild.props.teactOrderKey : undefined;
// That is indicated by a changed `teactOrderKey` value
const shouldMoveNode = (
currentChildInfo.index !== currentPreservedIndex && currentChildInfo.orderKey !== newOrderKey
currentChildInfo.index !== currentPreservedIndex && (!newOrderKey || currentChildInfo.orderKey !== newOrderKey)
);
const isMovingDown = shouldMoveNode && currentPreservedIndex > currentChildInfo.index;