You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Thoufiqkhan (via GitHub)" <gi...@apache.org> on 2024/05/24 06:40:56 UTC

[I] Superset throws unexpected error while loading filters in a dashboard. [superset]

Thoufiqkhan opened a new issue, #28687:
URL: https://github.com/apache/superset/issues/28687

   ### Bug description
   
   ![image](https://github.com/apache/superset/assets/44634034/290810c0-53ff-40d7-bfd7-65a3adc55254)
   The above error occurs when loading a dashboard, the filter doesn't seem to load. After a while, sometimes the issue gets resolved.
   I'm using superset 3.1.1 version and running it on docker in my local.
   
   ### How to reproduce the bug
   
   1. Go to dashboards
   2. Click on a dashboard
   3. On loading, the error occurs.
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   3.1.3
   
   ### Python version
   
   3.9
   
   ### Node version
   
   16
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [ ] I have searched Superset docs and Slack and didn't find a solution to my problem.
   - [ ] I have searched the GitHub issue tracker and didn't find a similar bug report.
   - [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.


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


Re: [I] Superset throws unexpected error while loading filters in a dashboard. [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #28687:
URL: https://github.com/apache/superset/issues/28687#issuecomment-2777257315

   Gonna have to close this one, since we no longer support superset 3.x, it's been silent for a very long time, and is largely inactionable since we don't have good reproduction steps here, and most people AFAIK weren't facing this. If you're facing this in 4.1.2 or newer, let us know the updated context and we can reopen.


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


Re: [I] Superset throws unexpected error while loading filters in a dashboard. [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #28687:
URL: https://github.com/apache/superset/issues/28687#issuecomment-2128706095

   <!-- Greeting -->
   @Thoufiqkhan Hello there! I'm here to help you with any bugs, questions, or becoming a contributor. Let's tackle this together!
   
   <!-- Answer -->
   To resolve the JavaScript runtime error "Cannot read properties of undefined (reading 'filter')" that occurs while loading filters in an Apache Superset dashboard, you need to ensure that the `dataMask` object is properly defined and not `undefined` before calling the `filter` method on it.
   
   In the provided code, the `useNativeFiltersDataMask` function is where the `filter` method is used on `dataMask`. To prevent the error, you should add a check to ensure `dataMask` is defined before attempting to use the `filter` method.
   
   Here is the modified `useNativeFiltersDataMask` function with the necessary check:
   
   ```ts
   export const useNativeFiltersDataMask = () => {
     const dataMask = useSelector<RootState, DataMaskStateWithId>(
       state => state.dataMask,
     );
   
     return useMemo(
       () =>
         dataMask
           ? Object.values(dataMask)
               .filter((item: DataMaskWithId) =>
                 String(item.id).startsWith(NATIVE_FILTER_PREFIX),
               )
               .reduce(
                 (prev, next: DataMaskWithId) => ({ ...prev, [next.id]: next }),
                 {},
               ) as DataMaskStateWithId
           : {},
       [dataMask],
     );
   };
   ```
   
   Additionally, ensure that the `dataMask` object is correctly initialized and populated in the relevant parts of your codebase. For example, in the `createHandleSave` function, make sure that the `defaultDataMask` is set properly:
   
   ```ts
   defaultDataMask: formInputs.defaultDataMask ?? getInitialDataMask(),
   ```
   
   Moreover, you can refer to the `superset-frontend/src/dashboard/components/nativeFilters/utils.ts` file for additional context on how filters are managed and applied in Apache Superset. This file includes functions like `getFormData`, `mergeExtraFormData`, and `getExtraFormData` which handle the form data and extra form data for filters. Ensuring these functions are correctly implemented and that `dataMask` and other related objects are properly managed can help prevent such runtime errors <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/state.ts)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/utils.ts)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/util/activeDashboardFilters.js)</sup><sup>[[4]](https://github.com/apache/superset/blob/master/superset-frontend/src/dash
 board/components/nativeFilters/utils.ts)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   <details open>
   <summary>
   
   #### Details
   </summary>
   
   **About Dosu**
   This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research.
   
   Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
   </details>
   
   *To continue the conversation, 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: 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


Re: [I] Superset throws unexpected error while loading filters in a dashboard. [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #28687: Superset throws unexpected error while loading filters in a dashboard.
URL: https://github.com/apache/superset/issues/28687


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