Repository: apache/superset
File: superset-frontend/src/explore/actions/hydrateExplore.ts (TypeScript)

Code before:
        common?.conf?.DEFAULT_TIME_FILTER || NO_TIME_RANGE;
    }
    if (
      initialFormData.include_time &&
      initialFormData.granularity_sqla &&
      !initialFormData.groupby?.some(
        (col: QueryFormColumn) =>
          getColumnLabel(col) ===
          getColumnLabel(initialFormData.granularity_sqla!),
      )
    ) {
      initialFormData.groupby = [
        initialFormData.granularity_sqla,
        ...ensureIsArray(initialFormData.groupby),
      ];
      initialFormData.granularity_sqla = undefined;
    }

    if (dashboardId) {
      initialFormData.dashboardId = dashboardId;
    }

    const initialDatasource = dataset;
    initialDatasource.currency_formats = Object.fromEntries(
      (initialDatasource.metrics ?? [])
        .filter(metric => metric.currency !== undefined)
        .map((metric): [string, Currency] => [
          metric.metric_name,
          metric.currency!,
        ]),
    );

    const initialExploreState = {
      form_data: initialFormData,
      slice: initialSlice,
      datasource: initialDatasource,
    };
    const initialControls = getControlsState(
      initialExploreState,
      initialFormData,
    ) as ControlStateMapping;
    const colorSchemeKey = initialControls.color_scheme && 'color_scheme';
    const linearColorSchemeKey =
      initialControls.linear_color_scheme && 'linear_color_scheme';
    // if the selected color scheme does not exist anymore
    // fallbacks and selects the available default one
    const verifyColorScheme = (type: ColorSchemeType) => {
      const schemes =
        type === 'CATEGORICAL'
          ? getCategoricalSchemeRegistry()
          : getSequentialSchemeRegistry();

Review comment (suggestion):
probably relates to the earlier comment- this won't pick up null values, so maybe 
```suggestion
        .filter(metric => !!metric.currency)
```
would filter out null and undefined values. (and false and 0, etc if that's what you want)

Code after:
        common?.conf?.DEFAULT_TIME_FILTER || NO_TIME_RANGE;
    }
    if (
      initialFormData.include_time &&
      initialFormData.granularity_sqla &&
      !initialFormData.groupby?.some(
        (col: QueryFormColumn) =>
          getColumnLabel(col) ===
          getColumnLabel(initialFormData.granularity_sqla!),
      )
    ) {
      initialFormData.groupby = [
        initialFormData.granularity_sqla,
        ...ensureIsArray(initialFormData.groupby),
      ];
      initialFormData.granularity_sqla = undefined;
    }

    if (dashboardId) {
      initialFormData.dashboardId = dashboardId;
    }

    const initialDatasource = dataset;
    initialDatasource.currency_formats = Object.fromEntries(
      (initialDatasource.metrics ?? [])
        .filter(metric => !!metric.currency)
        .map((metric): [string, Currency] => [
          metric.metric_name,
          metric.currency!,
        ]),
    );

    const initialExploreState = {
      form_data: initialFormData,
      slice: initialSlice,
      datasource: initialDatasource,
    };
    const initialControls = getControlsState(
      initialExploreState,
      initialFormData,
    ) as ControlStateMapping;
    const colorSchemeKey = initialControls.color_scheme && 'color_scheme';
    const linearColorSchemeKey =
      initialControls.linear_color_scheme && 'linear_color_scheme';
    // if the selected color scheme does not exist anymore
    // fallbacks and selects the available default one
    const verifyColorScheme = (type: ColorSchemeType) => {
      const schemes =
        type === 'CATEGORICAL'
          ? getCategoricalSchemeRegistry()
          : getSequentialSchemeRegistry();