Repository navigation
Conversation
Paging rendered the next list in a transition that suspended into the drawer fallback, and a new filterOptions object recreated the drawer component. Both remount the open drawer and replay its enter animation.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
What?
Keep an open list drawer mounted when the user changes pages or when
filterOptionsgets a new object identity. The drawer shell should stay put; only the list inside it should swap.Why?
useListDrawermemoizes the drawer component withfilterOptionsin its dependency list. Upload fields build that object inuseMemo, and a new identity makes React treatMemoizedDraweras a new component type. The open drawer unmounts and its enter animation runs again.Paging has the same visible result for a different reason.
ListDrawerContentwraps the list inSuspenseand renders.drawer__fade-inonly whileisLoadingis false. A synchronoussetListViewof the next server-rendered list suspends into the fallback, unmounts that node, and the 200ms fade-in runs again. The drawer looks like it closes and reopens on every page, instead of just replacing the rows.We hit this in an upload relationship drawer ("choose from existing") with a large image collection. It still happens with no custom list view installed. It is much more obvious in production, where the server render is slow enough for the unmount to be visible. In dev the swap is often fast enough that the animation is easy to miss.
How?
filterOptionsthrough a ref inside the memoized drawer, and drop it from theuseMemodependency list, so a new object does not recreate the component.setListViewinsidestartTransition. The previous list stays on screen until the next one can paint, so the drawer does not fall through theSuspensefallback and remount.drawer__fade-in.Reproduction (manual)