bito-code-review[bot] commented on PR #41509:
URL: https://github.com/apache/superset/pull/41509#issuecomment-4834600558

   <!-- Bito Reply -->
   The flagged issue is correct. When the `Samples` tab is conditionally 
removed from the `DataTablesPane` due to a datasource change, the 
`activeTabKey` state remains set to `'samples'`, causing the panel to render 
without content. To resolve this, you should add a `useEffect` hook in 
`DataTablesPane.tsx` that monitors `showSamplesTab` and resets `activeTabKey` 
to `ResultTypes.Results` if the current tab is no longer available.
   
   Here is the suggested fix for 
`superset-frontend/src/explore/components/DataTablesPane/DataTablesPane.tsx`:
   
   ```tsx
     useEffect(() => {
       if (!showSamplesTab && activeTabKey === ResultTypes.Samples) {
         setActiveTabKey(ResultTypes.Results);
       }
     }, [showSamplesTab, activeTabKey]);
   ```
   
   I have checked the PR comments and there are no other pending review 
comments to address. Would you like me to implement any other changes?
   
   
**superset-frontend/src/explore/components/DataTablesPane/DataTablesPane.tsx**
   ```
   useEffect(() => {
       if (!showSamplesTab && activeTabKey === ResultTypes.Samples) {
         setActiveTabKey(ResultTypes.Results);
       }
     }, [showSamplesTab, activeTabKey]);
   ```


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