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 2021/06/07 08:31:58 UTC

[GitHub] [superset] villebro commented on a change in pull request #14869: feat(native-filters): Support default to first value in select filter

villebro commented on a change in pull request #14869:
URL: https://github.com/apache/superset/pull/14869#discussion_r646374991



##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx
##########
@@ -178,10 +174,21 @@ const FilterBar: React.FC<FiltersBarProps> = ({
 
   const handleFilterSelectionChange = (
     filter: Pick<Filter, 'id'> & Partial<Filter>,
-    dataMask: Partial<DataMaskState>,
+    dataMask: Partial<DataMask>,
   ) => {
     setIsFilterSetChanged(tab !== TabIds.AllFilters);
     setDataMaskSelected(draft => {
+      // force instant updating on initialization or for parent filters when dataMaskSelected has filter

Review comment:
       This comment is not fully accurate; can we update this to reflect the fact that we are updating on initialization if `filter.requiredFirst` is true?

##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
##########
@@ -625,7 +627,11 @@ const FiltersConfigForm = (
                   {
                     validator: (rule, value) => {
                       const hasValue = !!value.filterState?.value;
-                      if (hasValue) {
+                      if (
+                        hasValue ||
+                        // TODO: do more generic
+                        formFilter.controlValues?.defaultToFirstItem
+                      ) {

Review comment:
       I'd recommend leaving this unchanged and just state in the description of `defaultToFirstItem` that the default value will be populated automatically, thus default value can't be set when `defaultToFirstItem` is set to `true`.




-- 
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.

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