From e17396ef9335c0445ed6cea2c38fb667003acf25 Mon Sep 17 00:00:00 2001 From: Uyarn Date: Thu, 28 Nov 2024 14:21:34 +0800 Subject: [PATCH] fix(Tree): fix scrollto behavior --- src/tree/Tree.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tree/Tree.tsx b/src/tree/Tree.tsx index 3e59babe42..7b322d6fb9 100644 --- a/src/tree/Tree.tsx +++ b/src/tree/Tree.tsx @@ -175,7 +175,7 @@ const Tree = forwardRef, TreeProps>((origi log.error('Tree', 'scrollToElement: one of `index` or `key` must exist.'); return; } - const data = isVirtual ? visibleData : visibleNodes; + const data = visibleNodes; index = data?.findIndex((item) => [get(item.data, 'key'), get(item.data, 'value')].includes(params.key)); if (index < 0) { log.error('Tree', `${params.key} does not exist in data, check \`key\` or \`data\` please.`); @@ -183,7 +183,7 @@ const Tree = forwardRef, TreeProps>((origi } scrollToElement({ ...params, index }); }, - [scrollToElement, isVirtual, visibleData, visibleNodes], + [scrollToElement, visibleNodes], ); /** 对外暴露的公共方法 * */ useImperativeHandle(