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

   <!-- Greeting -->
   Hello @CharlesNkdl, I'm here to help you with the issue you're facing. I'm a 
bot that can assist you with bug resolution, answer your questions, and guide 
you to become a contributor. Let's work together to get this sorted out.
   
   <!-- Answer -->
   To resolve the issue of exporting charts as blank images from multiple 
dashboards in Apache Superset version 4.0.1, you need to ensure that the charts 
are fully loaded before initiating the export process. The provided code 
snippet shows the `handleBulkChartExport` function, which handles the export of 
charts.
   
   Here is the relevant part of the code:
   
   ```tsx
   const handleBulkChartExport = (chartsToExport: Chart[]) => {
       const ids = chartsToExport.map(({ id }) => id);
       handleResourceExport('chart', ids, () => {
         setPreparingExport(false);
       });
       setPreparingExport(true);
     };
   ```
   
   To ensure that charts are fully loaded before exporting, you might need to 
add a check to confirm that the charts are rendered and ready. This can be done 
by verifying the loading state and ensuring that the charts are not in a 
loading state before calling the `handleBulkChartExport` function.
   
   Here is an example of how you might modify the function to include such a 
check:
   
   ```tsx
   const handleBulkChartExport = (chartsToExport: Chart[]) => {
       if (loading) {
         addDangerToast(t('Charts are still loading. Please wait until all 
charts are fully loaded before exporting.'));
         return;
       }
   
       const ids = chartsToExport.map(({ id }) => id);
       handleResourceExport('chart', ids, () => {
         setPreparingExport(false);
       });
       setPreparingExport(true);
     };
   ```
   
   This modification ensures that the export process is only initiated when the 
charts are fully loaded, preventing the issue of exporting blank images 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/features/home/ChartTable.tsx)</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-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