Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions apps/web/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1930,10 +1930,17 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
dragState === null && sidebarListItems.length + visibleDraftSessionCount > 0;
// Cache on both fields so layout-key changes trigger the effect even when animate is unchanged.
const listMotionPass = { layoutKey: listMotionLayoutKey, animate: listMotionAnimate };
const shelfExpansionKey = [workingShelfExpanded, snoozedShelfExpanded, settledShelfExpanded].join(
":",
);
const previousShelfExpansionKeyRef = useRef(shelfExpansionKey);
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tells the list motion controller to animate or not after each layout-affecting commit
useLayoutEffect(() => {
listMotionRef.current?.update(listMotionPass.animate);
}, [listMotionPass]);
// Shelf rows would travel over stationary headers below the bottom-anchored shelf.
const shelvesUnchanged = previousShelfExpansionKeyRef.current === shelfExpansionKey;
previousShelfExpansionKeyRef.current = shelfExpansionKey;
listMotionRef.current?.update(listMotionPass.animate && shelvesUnchanged);
}, [listMotionPass, shelfExpansionKey]);
const handleThreadDragOver = (event: DragOverEvent) => {
const target = event.over
? resolveSidebarDropTarget(sidebarListItems, String(event.active.id), String(event.over.id))
Expand Down
Loading