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

   <!-- Bito Reply -->
   The flagged issue is correct. The current implementation of `start()` in 
`superset-frontend/src/embedded/index.tsx` relies on a module-level 
`pluginsReady` promise that, once rejected, remains in a permanently rejected 
state. Subsequent calls to `start()` will immediately trigger the rejection 
handler, preventing any recovery or retry of the plugin initialization.
   
   To resolve this, you should refactor `pluginsReady` to be a function that 
returns a new promise, or re-initialize the promise upon failure. Here is a 
concise fix for `superset-frontend/src/embedded/index.tsx`:
   
   ```tsx
   // Replace the module-level pluginsReady promise with a factory function
   const getPluginsReady = () =>
     initPreamble().then(async () => {
       await Promise.all([import("src/setup/setupPlugins"), 
import("src/setup/setupCodeOverrides")]);
       setupPlugins();
       setupCodeOverrides({ embedded: true });
     });
   
   // Then update start() to call getPluginsReady()
   function start() {
     // ...
     return getPluginsReady().then(
       () => { /* ... success path ... */ },
       err => { /* ... failure path ... */ }
     );
   }
   ```
   
   I have checked the PR comments and there are no other comments to address. 
Would you like me to implement this fix for you?
   
   **superset-frontend/src/embedded/index.tsx**
   ```
   const getPluginsReady = () =>
     initPreamble().then(async () => {
       await Promise.all([import("src/setup/setupPlugins"), 
import("src/setup/setupCodeOverrides")]);
       setupPlugins();
       setupCodeOverrides({ embedded: true });
     });
   
   function start() {
     // ...
     return getPluginsReady().then(
       () => { /* ... success path ... */ },
       err => { /* ... failure path ... */ }
     );
   }
   ```


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