dosubot[bot] commented on issue #29289:
URL: https://github.com/apache/superset/issues/29289#issuecomment-2175608327

   <!-- Answer -->
   The `extra_filters` argument is used in the `getFormDataWithExtraFilters` 
function to handle additional filters applied to charts in Superset. This 
function processes the `extra_filters` argument to generate the necessary form 
data for rendering charts.
   
   Here's an example of how `getFormDataWithExtraFilters` is used:
   
   ```ts
   export default function getFormDataWithExtraFilters({
     chart,
     filters,
     nativeFilters,
     chartConfiguration,
     colorScheme,
     colorNamespace,
     sliceId,
     dataMask,
     extraControls,
     labelColors,
     sharedLabelColors,
     allSliceIds,
   }: GetFormDataWithExtraFiltersArguments) {
     // if dashboard metadata + filters have not changed, use cache if possible
     const cachedFormData = cachedFormdataByChart[sliceId];
     if (
       cachedFiltersByChart[sliceId] === filters &&
       areObjectsEqual(cachedFormData?.color_scheme, colorScheme, {
         ignoreUndefined: true,
       }) &&
       areObjectsEqual(cachedFormData?.color_namespace, colorNamespace, {
         ignoreUndefined: true,
       }) &&
       areObjectsEqual(cachedFormData?.label_colors, labelColors, {
         ignoreUndefined: true,
       }) &&
       areObjectsEqual(cachedFormData?.shared_label_colors, sharedLabelColors, {
         ignoreUndefined: true,
       }) &&
       !!cachedFormData &&
       areObjectsEqual(cachedFormData?.dataMask, dataMask, {
         ignoreUndefined: true,
       }) &&
       areObjectsEqual(cachedFormData?.extraControls, extraControls, {
         ignoreUndefined: true,
       })
     ) {
       return cachedFormData;
     }
   
     let extraData: { extra_form_data?: JsonObject } = {};
     const activeFilters = getAllActiveFilters({
       chartConfiguration,
       dataMask,
       nativeFilters,
       allSliceIds,
     });
     const filterIdsAppliedOnChart = Object.entries(activeFilters)
       .filter(([, { scope }]) => scope.includes(chart.id))
       .map(([filterId]) => filterId);
     if (filterIdsAppliedOnChart.length) {
       extraData = {
         extra_form_data: getExtraFormData(dataMask, filterIdsAppliedOnChart),
       };
     }
     const formData = {
       ...chart.form_data,
       label_colors: labelColors,
       shared_label_colors: sharedLabelColors,
       ...(colorScheme && { color_scheme: colorScheme }),
       extra_filters: getEffectiveExtraFilters(filters),
       ...extraData,
       ...extraControls,
     };
   
     cachedFiltersByChart[sliceId] = filters;
     cachedFormdataByChart[sliceId] = { ...formData, dataMask, extraControls };
   
     return formData;
   }
   ```
   
   Ensure that the `getFormDataWithExtraFilters` function is correctly defined 
and used in your codebase. If the function is not handling the `extra_filters` 
argument properly, you may need to update it to ensure it processes the 
`extra_filters` argument as expected 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


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

Reply via email to