michael-s-molina commented on code in PR #20690:
URL: https://github.com/apache/superset/pull/20690#discussion_r927053488
##########
superset-frontend/src/components/Select/AsyncSelect.tsx:
##########
@@ -706,20 +689,20 @@ const AsyncSelect = (
getPopupContainer={
getPopupContainer || (triggerNode => triggerNode.parentNode)
}
- labelInValue={isAsync || labelInValue}
+ labelInValue
maxTagCount={MAX_TAG_COUNT}
mode={mappedMode}
notFoundContent={isLoading ? t('Loading...') : notFoundContent}
onDeselect={handleOnDeselect}
onDropdownVisibleChange={handleOnDropdownVisibleChange}
- onPopupScroll={isAsync ? handlePagination : undefined}
- onSearch={shouldShowSearch ? handleOnSearch : undefined}
+ onPopupScroll={handlePagination}
+ onSearch={showSearch ? handleOnSearch : undefined}
onSelect={handleOnSelect}
onClear={handleClear}
onChange={onChange}
options={hasCustomLabels ? undefined : fullSelectOptions}
placeholder={placeholder}
- showSearch={shouldShowSearch}
+ showSearch
Review Comment:
Can you also make sure to memoize `initialValue` in the Storybook?
Otherwise, if you set it to true in Storybook we'll end up with an infinite
loop. When the story re-renders due to a request, it's passing a new value
object every time which in turn will fire a request again and so on.
```
const initialValue = useMemo(
() => ({ label: 'Valentina', value: 'Valentina' }),
[],
);
<AsyncSelect
...
value={withInitialValue ? initialValue : undefined}
/>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]