endimonan commented on code in PR #38470:
URL: https://github.com/apache/superset/pull/38470#discussion_r2911552509
##########
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx:
##########
@@ -504,39 +547,57 @@ export default function PluginFilterSelect(props:
PluginFilterSelectProps) {
onChange={handleExclusionToggle}
/>
)}
- <Select
- name={formData.nativeFilterId}
- allowClear
- allowNewOptions={!searchAllOptions && creatable !== false}
- allowSelectAll={!searchAllOptions}
- value={multiSelect ? filterState.value || [] : filterState.value}
- disabled={isDisabled}
- getPopupContainer={
- showOverflow
- ? () => (parentRef?.current as HTMLElement) || document.body
- : (trigger: HTMLElement) =>
- (trigger?.parentNode as HTMLElement) || document.body
- }
- showSearch={showSearch}
- mode={multiSelect ? 'multiple' : 'single'}
- placeholder={placeholderText}
- onClear={() => onSearch('')}
- onSearch={onSearch}
- onBlur={handleBlur}
- onFocus={setFocusedFilter}
- onMouseEnter={setHoveredFilter}
- onMouseLeave={unsetHoveredFilter}
- // @ts-expect-error
- onChange={handleChange}
- ref={inputRef}
- loading={isRefreshing}
- oneLine={filterBarOrientation === FilterBarOrientation.Horizontal}
- invertSelection={inverseSelection && excludeFilterValues}
- options={options}
- sortComparator={sortComparator}
- onOpenChange={setFilterActive}
- className="select-container"
- />
+ {isLikeOperator ? (
+ <Input
+ allowClear
+ placeholder={likeInputPlaceholder}
+ defaultValue={
+ filterState.value?.[0] != null
+ ? String(filterState.value[0])
+ : undefined
+ }
+ onChange={handleLikeInputChange}
+ onFocus={setFocusedFilter}
+ onBlur={unsetFocusedFilter}
+ onMouseEnter={setHoveredFilter}
+ onMouseLeave={unsetHoveredFilter}
+ disabled={isDisabled}
+ />
Review Comment:
Good catch, fixed. Switched to a controlled Input with local state
(likeInputValue) synced via useEffect. Also clears on clearAllTrigger.
--
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]