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

   <!-- Greeting -->
   @Slaheddine Merhaba! I'm here to help you with any bugs, questions, or 
contributions you have for the repository. Let me know how I can assist you!
   
   <!-- Answer -->
   To resolve the issue of dashboards not displaying correctly and remaining in 
a loading state indefinitely after migrating to app version 4.0.1 and Helm 
Chart 0.12.11, you should ensure that the `hydrateDashboard` function is being 
called correctly and that the necessary data (dashboard, charts, datasets) is 
being fetched and processed properly.
   
   Here are the key points to check and ensure:
   
   1. **Data Fetching**: Ensure that the `useDashboard`, `useDashboardCharts`, 
and `useDashboardDatasets` hooks are correctly fetching the required data. 
Check for any errors in these hooks and handle them appropriately.
   
   2. **Hydration**: Ensure that the `hydrateDashboard` function is being 
called with the correct parameters. This function should be called only when 
`readyToRender` is `true` and `isDashboardHydrated.current` is `false`.
   
   3. **Error Handling**: Ensure that any errors in fetching data are properly 
handled and displayed using `addDangerToast`.
   
   4. **Loading State**: Ensure that the loading state is correctly managed and 
that the `Loading` component is displayed only when necessary. Additionally, 
verify that the `isDashboardLoading` function is correctly determining the 
loading state of the charts.
   
   Here is the relevant part of the code that handles these aspects:
   
   ```tsx
   useEffect(() => {
     // eslint-disable-next-line consistent-return
     async function getDataMaskApplied() {
       const permalinkKey = getUrlParam(URL_PARAMS.permalinkKey);
       const nativeFilterKeyValue = getUrlParam(URL_PARAMS.nativeFiltersKey);
       const isOldRison = getUrlParam(URL_PARAMS.nativeFilters);
   
       let dataMask = nativeFilterKeyValue || {};
       // activeTabs is initialized with undefined so that it doesn't override
       // the currently stored value when hydrating
       let activeTabs: string[] | undefined;
       if (permalinkKey) {
         const permalinkValue = await getPermalinkValue(permalinkKey);
         if (permalinkValue) {
           ({ dataMask, activeTabs } = permalinkValue.state);
         }
       } else if (nativeFilterKeyValue) {
         dataMask = await getFilterValue(id, nativeFilterKeyValue);
       }
       if (isOldRison) {
         dataMask = isOldRison;
       }
   
       if (readyToRender) {
         if (!isDashboardHydrated.current) {
           isDashboardHydrated.current = true;
         }
         dispatch(
           hydrateDashboard({
             history,
             dashboard,
             charts,
             activeTabs,
             dataMask,
           }),
         );
       }
       return null;
     }
     if (id) getDataMaskApplied();
     // eslint-disable-next-line react-hooks/exhaustive-deps
   }, [readyToRender]);
   ```
   
   Ensure that the `readyToRender` variable is correctly set to `true` only 
when both `dashboard` and `charts` are available:
   
   ```tsx
   const readyToRender = Boolean(dashboard && charts);
   ```
   
   Additionally, verify that the `isDashboardLoading` function is correctly 
determining the loading state of the charts:
   
   ```js
   export default function isDashboardLoading(charts) {
     return Object.values(charts).some(
       chart => chart.chartUpdateStartTime > (chart.chartUpdateEndTime || 0),
     );
   }
   ```
   
   If the issue persists, you may need to debug further to ensure that all 
necessary data is being fetched and processed correctly, and that there are no 
issues with the `hydrateDashboard` function or the data it relies on 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/containers/DashboardPage.tsx)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/util/isDashboardLoading.js)</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: notifications-unsubscr...@superset.apache.org

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


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

Reply via email to