don't use ternary operator when displaying motion previews

the main previews were being unnecessarily unmounted
This commit is contained in:
Josh Hawkins 2026-03-08 11:49:02 -05:00
parent 6817108a95
commit d1793207b4

View File

@ -1284,7 +1284,7 @@ function MotionReview({
return ( return (
<> <>
{motionPreviewsCamera && selectedMotionPreviewCamera ? ( {selectedMotionPreviewCamera && (
<> <>
<div className="relative mb-2 flex h-11 items-center justify-between pl-2 pr-2 md:px-3"> <div className="relative mb-2 flex h-11 items-center justify-between pl-2 pr-2 md:px-3">
<Button <Button
@ -1465,10 +1465,15 @@ function MotionReview({
}} }}
/> />
</> </>
) : ( )}
<div className="no-scrollbar flex min-w-0 flex-1 flex-wrap content-start gap-2 overflow-y-auto md:gap-4">
<div <div
ref={contentRef} className={cn(
"no-scrollbar flex min-w-0 flex-1 flex-wrap content-start gap-2 overflow-y-auto md:gap-4",
selectedMotionPreviewCamera && "hidden",
)}
>
<div
ref={selectedMotionPreviewCamera ? undefined : contentRef}
className={cn( className={cn(
"no-scrollbar grid w-full grid-cols-1", "no-scrollbar grid w-full grid-cols-1",
isMobile && "landscape:grid-cols-2", isMobile && "landscape:grid-cols-2",
@ -1562,7 +1567,6 @@ function MotionReview({
})} })}
</div> </div>
</div> </div>
)}
{!selectedMotionPreviewCamera && ( {!selectedMotionPreviewCamera && (
<div className="no-scrollbar w-[55px] overflow-y-auto md:w-[100px]"> <div className="no-scrollbar w-[55px] overflow-y-auto md:w-[100px]">
{motionData ? ( {motionData ? (