fix(sidebar): correct expansion-key format for virtualizer buffer (#1711)
* fix(sidebar): increase virtualizer buffer for expanded parents Fix #1530: archive sub-session layout broken because the virtualizer used a fixed 28px height estimate per row. Expanded parents with inline children are much taller. Now dynamically increases bufferSize when expanded parents are present. * fix(sidebar): correct expansion-key format for virtualizer buffer The expansion key was using raw sessionId instead of the scoped format 'project:{archived|active}:{sessionId}'. This made hasExpandedParent always false, so bufferSize never increased. Also removed dead hasSessionSearchQuery branch. --------- Co-authored-by: Leonid Skorobogatyy <bash@opencode.itc.local>
This commit is contained in:
committed by
GitHub
co-authored by
Leonid Skorobogatyy
parent
a25fc4c25a
commit
57cef1b278
@@ -350,6 +350,7 @@ function SessionGroupSectionBase(props: Props): React.ReactNode {
|
||||
setRenameFolderDraft,
|
||||
setRenamingFolderId,
|
||||
pinnedSessionIds,
|
||||
expandedParents,
|
||||
sessionOrderIndex,
|
||||
currentSessionId,
|
||||
editingId,
|
||||
@@ -569,6 +570,16 @@ function SessionGroupSectionBase(props: Props): React.ReactNode {
|
||||
&& visibleSessions.length >= ACTIVE_VIRTUALIZE_THRESHOLD;
|
||||
const shouldVirtualize = shouldVirtualizeArchived || shouldVirtualizeActive;
|
||||
|
||||
// Check if any parent node is expanded - expanded parents render their
|
||||
// children inline, making them much taller than the fixed estimate.
|
||||
// When expanded parents exist, increase bufferSize to cover the extra height.
|
||||
const bucketTag = group.isArchivedBucket ? 'archived' : 'active';
|
||||
const hasExpandedParent = shouldVirtualize && visibleSessions.some((node) => {
|
||||
if (node.children.length === 0) return false;
|
||||
const expansionKey = `project:${bucketTag}:${node.session.id}`;
|
||||
return expandedParents.has(expansionKey);
|
||||
});
|
||||
|
||||
const archivedVirtualContainerRef = React.useRef<HTMLDivElement | null>(null);
|
||||
const archivedScrollRef = React.useRef<HTMLElement | null>(null);
|
||||
const [archivedScrollEl, setArchivedScrollEl] = React.useState<HTMLElement | null>(null);
|
||||
@@ -904,7 +915,7 @@ function SessionGroupSectionBase(props: Props): React.ReactNode {
|
||||
<Virtualizer
|
||||
data={visibleSessions}
|
||||
itemSize={ARCHIVED_ROW_ESTIMATE_PX}
|
||||
bufferSize={ARCHIVED_ROW_ESTIMATE_PX * 8}
|
||||
bufferSize={hasExpandedParent ? ARCHIVED_ROW_ESTIMATE_PX * 20 : ARCHIVED_ROW_ESTIMATE_PX * 8}
|
||||
scrollRef={archivedScrollRef}
|
||||
startMargin={archivedScrollMargin}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user