endimonan commented on code in PR #38470:
URL: https://github.com/apache/superset/pull/38470#discussion_r2935282423
##########
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx:
##########
@@ -483,6 +506,47 @@ export default function PluginFilterSelect(props:
PluginFilterSelectProps) {
setExcludeFilterValues(value === 'true');
};
+ const debouncedLikeChange = useMemo(
+ () =>
+ debounce((text: string) => {
+ if (text) {
+ updateDataMask([text]);
+ } else {
+ updateDataMask(null);
+ }
+ }, Constants.SLOW_DEBOUNCE),
+ [updateDataMask],
+ );
+
+ useEffect(() => {
+ if (!isLikeOperator || clearAllTrigger) {
+ debouncedLikeChange.cancel();
+ }
+ }, [clearAllTrigger, debouncedLikeChange, isLikeOperator]);
+
+ useEffect(() => () => debouncedLikeChange.cancel(), [debouncedLikeChange]);
Review Comment:
It doesn't seem to me to be a real regression in this component...
debouncedLikeChange is recreated only when updateDataMask changes and this
depends on filter-state, not ordinary typing renders so normal text entry does
not recreate the debounced callback.
Canceling the previous debounced instance is intentional because it prevents
stale LIKE updates from replaying after clearAll. This is what was fixed here.
So I don't see a concrete reproduction where a user input is silently
dropped during normal typing, while the proposed ref-based change would weaken
the stale-work cancellation we want.
--
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]