{hasSubfolders ? (
{childFolders.map(child => (
))}
) : null}
)
}
/**
* Memoized for the secondary panel: the tree re-renders on every navigation,
* hash change, or searchParams flip in `LibrarySecondaryNav`. Without memo,
* each level recurses through `Collapsible` + `Tip` + `DropdownMenu` per
* branch (an inactive subtree of ~10–20 folders is ~30+ Radix instances) and
* pegs frame budget on otherwise unrelated route changes.
*
* Memoization is safe with reference equality because the parent passes
* stable refs:
* - `folder`, `folders` — from `libraryFolderBridge?.folders ?? DEFAULT…`
* (state, not recomputed each render).
* - `pathname` — string from `useLocation()`.
* - `hubSearchParams` — react-router-dom v7 `useSearchParams` memoizes
* via `useMemo` on `location.search` (see chunk-66UKHEGQ.js#L716).
* - `nav` — `useMemo` over `searchParams.toString()` in `LibrarySecondaryNav`.
* - `canManageFolders` / `canManageAccess` — booleans.
* - All four callbacks — wrapped in `useCallback` in `LibrarySecondaryNav`.
*
* Recursive children render `` (the exported
* memoized const), so memoization composes down the tree.
*/
export const LibraryFolderTreeBranch = React.memo(LibraryFolderTreeBranchInner)