You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/09/15 23:57:44 UTC

[GitHub] [superset] diegomedina248 commented on a diff in pull request #21443: feat(filters): add onFilterUpdate handler to list view filters

diegomedina248 commented on code in PR #21443:
URL: https://github.com/apache/superset/pull/21443#discussion_r972504576


##########
superset-frontend/src/components/ListView/Filters/index.tsx:
##########
@@ -74,9 +85,19 @@ function UIFilters(
                 initialValue={initialValue}
                 key={id}
                 name={id}
-                onSelect={(option: SelectOption | undefined) =>
-                  updateFilterValue(index, option)
-                }
+                onSelect={(
+                  option: SelectOption | undefined,
+                  isClear?: boolean,
+                ) => {
+                  if (onFilterUpdate) {
+                    // Filter change triggers both onChange AND onClear, only want to track onChange
+                    if (!isClear) {
+                      onFilterUpdate(option);

Review Comment:
   `onFilterUpdate?.(option);` would work too



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org