rusackas commented on code in PR #44880:
URL: https://github.com/apache/superset/pull/44880#discussion_r4261190356
##########
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx:
##########
@@ -200,11 +221,23 @@ export default function PluginFilterSelect(props:
PluginFilterSelectProps) {
const [likeInputValue, setLikeInputValue] = useState<string>(
filterState.value?.[0] != null ? String(filterState.value[0]) : '',
);
+ // null until the user types in the LIKE input; distinguishes a real edit
+ // from the clearAllTrigger reset below, which also clears likeInputValue
+ // but must not re-trigger a dispatch once the deferred value catches up.
+ const [pendingLikeValue, setPendingLikeValue] = useState<string |
null>(null);
+ const settleLikeValue = useMemo(
+ () => debounce(setPendingLikeValue, Constants.SLOW_DEBOUNCE),
+ [],
+ );
+ useEffect(() => () => settleLikeValue.cancel(), [settleLikeValue]);
useEffect(() => {
const externalValue =
filterState.value?.[0] != null ? String(filterState.value[0]) : '';
setLikeInputValue(externalValue);
+ // A parent-driven value change supersedes any settled edit, so re-entering
+ // the same text afterwards registers as a fresh edit.
+ setPendingLikeValue(null);
Review Comment:
@sadpandajoe good point, the `Bob` default masked it. The regression now
resets to `undefined` with no replacement default, then re-enters `Jen` and
asserts a new Contains mask. Pushed 303c3d7. I could not run jest locally, so
leaning on CI.
--
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]