GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(web): prevent sidebar shelf animations from overlapping headers (… · Pipyakas/t3code@f07b569

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src/components
    • Sidebar.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/Sidebar.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/Sidebar.tsx
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,10 +1990,17 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
19901990
dragState === null && sidebarListItems.length + visibleDraftSessionCount > 0;
19911991
// Cache on both fields so layout-key changes trigger the effect even when animate is unchanged.
19921992
const listMotionPass = { layoutKey: listMotionLayoutKey, animate: listMotionAnimate };
1993+
const shelfExpansionKey = [workingShelfExpanded, snoozedShelfExpanded, settledShelfExpanded].join(
1994+
":",
1995+
);
1996+
const previousShelfExpansionKeyRef = useRef(shelfExpansionKey);
19931997
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- tells the list motion controller to animate or not after each layout-affecting commit
19941998
useLayoutEffect(() => {
1995-
listMotionRef.current?.update(listMotionPass.animate);
1996-
}, [listMotionPass]);
1999+
// Shelf rows would travel over stationary headers below the bottom-anchored shelf.
2000+
const shelvesUnchanged = previousShelfExpansionKeyRef.current === shelfExpansionKey;
2001+
previousShelfExpansionKeyRef.current = shelfExpansionKey;
2002+
listMotionRef.current?.update(listMotionPass.animate && shelvesUnchanged);
2003+
}, [listMotionPass, shelfExpansionKey]);
19972004
const handleThreadDragOver = (event: DragOverEvent) => {
19982005
const target = event.over
19992006
? resolveSidebarDropTarget(sidebarListItems, String(event.active.id), String(event.over.id))

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.