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

   <!-- Bito Reply -->
   The flagged issue is correct. The `ChatbotMount` component currently 
initializes and renders the first-registered chatbot before the asynchronous 
settings fetch completes, leading to a transient render of the wrong provider. 
   
   To resolve this, you should introduce a loading state to defer rendering 
until the settings have been fetched. Here is a concise implementation for 
`superset-frontend/src/components/ChatbotMount/index.tsx`:
   
   ```tsx
   const ChatbotMount = () => {
     const [isLoaded, setIsLoaded] = useState(false);
     // ... existing refs and useSyncExternalStore
   
     useEffect(() => {
       loadExtensionSettings()
         .catch(() => {})
         .finally(() => setIsLoaded(true));
     }, []);
   
     if (!isLoaded) return null;
   
     // ... existing rendering logic
   ```
   
   I have checked the PR comments and there are no other actionable suggestions 
in the provided context. Would you like me to review any other parts of the PR?
   
   **superset-frontend/src/components/ChatbotMount/index.tsx**
   ```
   const [isLoaded, setIsLoaded] = useState(false);
     // ... existing refs and useSyncExternalStore
   
     useEffect(() => {
       loadExtensionSettings()
         .catch(() => {})
         .finally(() => setIsLoaded(true));
     }, []);
   
     if (!isLoaded) return null;
   ```


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