We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eef48dc commit fadddc7Copy full SHA for fadddc7
packages/tree/src/useFlattenedTreeList.ts
@@ -142,9 +142,12 @@ export default function useFlattenedTreeList({
142
return flattenedItems.reduce<ItemCollection>(
143
(collection, item) => {
144
const { parentId, itemId } = item;
145
- const isVisible =
146
- parentId === rootId ||
147
- (parentId !== null && expandedIds.includes(parentId));
+ let isVisible = parentId === rootId;
+ if (parentId !== null && expandedIds.includes(parentId)) {
+ // need to also make sure that the parent is visible
148
+ isVisible =
149
+ (collection.itemRefs[parentId]?.visibleIndex ?? -1) !== -1;
150
+ }
151
152
collection.itemRefs[itemId] = {
153
id: item.id,
0 commit comments