sadpandajoe commented on code in PR #41491:
URL: https://github.com/apache/superset/pull/41491#discussion_r3494806961
##########
superset-frontend/src/embedded/index.tsx:
##########
@@ -190,34 +197,44 @@ function start() {
method: 'GET',
endpoint: '/api/v1/me/roles/',
});
- return pluginsReady.then(() =>
- getMeWithRole().then(
- ({ result }) => {
- // fill in some missing bootstrap data
- // (because at pageload, we don't have any auth yet)
- // this allows the frontend's permissions checks to work.
- bootstrapData.user = result;
- store.dispatch({
- type: USER_LOADED,
- user: result,
- });
- if (!root) {
- root = createRoot(appMountPoint);
- }
- root.render(<EmbeddedApp />);
- },
- err => {
- // something is most likely wrong with the guest token; reset the guard
- // so a rehandshake with a valid token can retry.
- logging.error(err);
- showFailureMessage(
- t(
- 'Something went wrong with embedded authentication. Check the dev
console for details.',
- ),
- );
- started = false;
- },
- ),
+ return pluginsReady.then(
+ () =>
+ getMeWithRole().then(
+ ({ result }) => {
+ // fill in some missing bootstrap data
+ // (because at pageload, we don't have any auth yet)
+ // this allows the frontend's permissions checks to work.
+ bootstrapData.user = result;
+ store.dispatch({
+ type: USER_LOADED,
+ user: result,
+ });
+ if (!root) {
+ root = createRoot(appMountPoint);
+ }
+ root.render(<EmbeddedApp />);
+ },
+ err => {
+ // something is most likely wrong with the guest token; reset the
guard
+ // so a rehandshake with a valid token can retry.
+ logging.error(err);
+ showFailureMessage(
+ t(
+ 'Something went wrong with embedded authentication. Check the
dev console for details.',
+ ),
+ );
+ started = false;
+ },
+ ),
+ err => {
+ // setupPlugins() or setupCodeOverrides() threw while preparing plugins;
+ // reset the guard and recreate pluginsReady so a retry actually re-runs
+ // plugin setup instead of chaining off this rejected promise and leaving
+ // the dashboard stuck in a failed state.
+ logging.error(err);
+ pluginsReady = loadPlugins();
+ started = false;
+ },
Review Comment:
can this still be rejected before the next `start()` attaches a handler?
--
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]