Skip to content

Commit 39852ac

Browse files
authored
Merge pull request #1619 from sheinsight/fix/select-loadmore-filter
fix: 修复 Select 开启 onFilter 后输入关键字进行滚动加载时列表重置到第一条的问题
2 parents 4871858 + 966698f commit 39852ac

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sheinx",
33
"private": true,
4-
"version": "3.9.9-beta.12",
4+
"version": "3.9.9-beta.13",
55
"description": "A react library developed with sheinx",
66
"module": "dist/index.js",
77
"types": "dist/index.d.ts",

packages/base/src/select/select.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ function Select<DataItem, Value>(props0: SelectPropsBase<DataItem, Value>) {
153153
filterDelay: props.filterDelay,
154154
});
155155

156+
const prevFilterTextRef = useRef(filterText);
157+
const filterTextChanged = prevFilterTextRef.current !== filterText;
158+
prevFilterTextRef.current = filterText;
159+
156160
const [absoluteListUpdateKey, setAbsoluteListUpdateKey] = useState('');
157161

158162
const onCollapse = usePersistFn((collapse: boolean) => {
@@ -662,7 +666,7 @@ function Select<DataItem, Value>(props0: SelectPropsBase<DataItem, Value>) {
662666
renderItem,
663667
controlType,
664668
onLoadMore,
665-
keepScrollTop: !!filterText ? false : true,
669+
keepScrollTop: filterTextChanged ? false : true,
666670
isAnimationFinish,
667671
threshold,
668672
onControlTypeChange: setControlType,

packages/shineout/src/select/__doc__/changelog.cn.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 3.9.9-beta.13
2+
2026-02-06
3+
### 🐞 BugFix
4+
- 修复 `Select` 开启 `onFilter` 后输入关键字进行滚动加载时列表重置到第一条的问题 ([#1619](https://github.com/sheinsight/shineout-next/pull/1619))
5+
6+
17
## 3.9.9-beta.12
28
2026-02-05
39
### 🐞 BugFix

0 commit comments

Comments
 (0)