`ListBox` doesn't properly restore the search box input
- 主要語言
- JavaScript
- 星號
- 6
- 分支
- 0
- 平均合併
- 21 小時 41 分鐘
- 30 天內合併 PR
- 1
描述
When using the `showSearch` and `searchLimit` properties, the search input will clear itself despite the filter still being applied.
1. Create a `ListBox` with `showSearch={true}` and `searchLimit={10}`, and with more than 10 options.
2. Input some filter text into the search area.
3. Filter the options externally so that there are fewer than 10 options, and the search area is hidden.
4. Undo the filter to restore the search area.
5. The search filter is still applied, but the search input is blank.
```jsx
const options = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten']
const MyComponent = (): JSX.Element => {
const [filter, setFilter] = useState(false)
const toggleFilter = (): void => { setFilter(!filter) }
return (
]}
items={options
.filter((_, index) => !filter || index < 3)
.map(option => ({ name: option, value: option }))}
onChange={() => {}}
/>
)
}
```
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。