Skip to content

Commit 4075e10

Browse files
committed
fix: fix resetting height after re-computation
1 parent 052e5b7 commit 4075e10

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Tree.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ export const createTreeComputer = <
220220

221221
if (typeof value === 'string' || typeof value === 'symbol') {
222222
id = value;
223+
224+
if (records[id as string]) {
225+
updateRecordOnWalk(records[id as string]!, options);
226+
}
223227
} else {
224228
({id} = value);
225229
const record = records[id as string];

src/VariableSizeTree.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ export class VariableSizeTree<T extends VariableSizeNodeData> extends Tree<
132132
);
133133
}
134134

135+
public recomputeTree(options?: VariableSizeUpdateOptions): Promise<void> {
136+
return super.recomputeTree(options).then(() => {
137+
if (options?.useDefaultHeight) {
138+
this.list.current?.resetAfterIndex(0, true);
139+
}
140+
});
141+
}
142+
135143
public render(): ReactNode {
136144
const {children, itemSize, rowComponent, treeWalker, ...rest} = this.props;
137145

0 commit comments

Comments
 (0)