Skip to content

Commit 71c3162

Browse files
committed
fix: scroll menu list to top on input change and fix condition for showing create option
1 parent a8053e2 commit 71c3162

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.2.2-beta-7",
3+
"version": "0.2.2-beta-10",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/SelectPicker/common.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,14 @@ export const SelectPickerMenuList = <OptionValue, IsMulti extends boolean>({
179179
SelectPickerProps<OptionValue, IsMulti>,
180180
'renderMenuListFooter' | 'shouldRenderCustomOptions' | 'renderCustomOptions'
181181
>) => {
182-
const { children } = props
182+
const {
183+
children,
184+
selectProps: { inputValue },
185+
} = props
183186

184187
return (
185-
<components.MenuList {...props}>
188+
// added key here to explicitly re-render the list on input change so that the top option is rendered
189+
<components.MenuList {...props} key={inputValue}>
186190
<div className="py-4 cursor">{shouldRenderCustomOptions ? renderCustomOptions() : children}</div>
187191
{/* Added to the bottom of menu list to prevent from hiding when the menu is opened close to the bottom of the screen */}
188192
{!shouldRenderCustomOptions && renderMenuListFooter && (

0 commit comments

Comments
 (0)