You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "eschutho (via GitHub)" <gi...@apache.org> on 2026/06/03 18:03:17 UTC

[PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

eschutho opened a new pull request, #40729:
URL: https://github.com/apache/superset/pull/40729

   ### SUMMARY
   
   Fixes a race condition where `t()` calls inside chart plugin control panel configs and menu components were evaluated and cached before the language pack finished loading, causing translated strings to appear in English when a non-English locale is configured.
   
   **Root cause:** `preamble.ts` is prepended to all webpack entry points and starts `initPreamble()` eagerly, but the language pack fetch is async. In two entry points, synchronous module-level code ran before that promise resolved:
   
   - **`embedded/index.tsx`**: `setupPlugins()` was called at module top level. Webpack evaluates this synchronously at bundle parse time, pulling in the entire chart plugin module tree. All module-level `t()` calls in control panel configs execute and cache English strings before the language pack arrives.
   - **`menu.tsx`**: `createRoot().render()` was called synchronously, so React could begin rendering Menu components (and evaluating their `t()` calls) before the language pack resolved.
   
   The `spa` entry point (`views/index.tsx`) already handled this correctly: it `await`s `initPreamble()` before doing `import('./App')` with `webpackMode: "eager"`, which defers the entire App module tree evaluation until after the language pack loads.
   
   **Changes:**
   
   - `embedded/index.tsx`: Removes top-level `setupPlugins()` / `setupCodeOverrides()` and replaces them with a `pluginsReady` promise that chains off `initPreamble()`. `start()` (which triggers rendering) chains off `pluginsReady`, guaranteeing plugins are initialized with translations before the dashboard renders. If preamble fails for non-language-pack reasons, plugins still load and the page renders in English rather than showing nothing.
   - `menu.tsx`: Wraps `createRoot().render()` in `initPreamble().catch().then()` so the menu only renders after the language pack is configured.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Tested with German locale (`de`) and a 2-second artificial delay injected on the language pack endpoint via `page.route()`.
   
   **menu.tsx** — page heading and section labels render in German despite the delay:
   
   ![menu translated](https://github.com/user-attachments/assets/placeholder-menu)
   
   Verified strings: **Startseite** (Home), **Zuletzt verwendet** (Recents), **Diagramme** (Charts), **Gespeicherte Abfragen** (Saved queries)
   
   **embedded/index.tsx** — auth error message renders in German, confirming `start()` waited for `pluginsReady` before calling `t()`:
   
   Verified string: **Bei der eingebetteten Authentifizierung ist ein Fehler aufgetreten. Weitere Details im Entwicklerkonsolenfenster.**
   
   ### TESTING INSTRUCTIONS
   
   1. Configure Superset with a non-English locale (e.g. `BABEL_DEFAULT_LOCALE = 'de'`).
   2. In a browser devtools network throttle or via a proxy, add latency to the `/superset/language_pack/<lang>/` response.
   3. Load a backend-rendered Flask view (e.g. `/superset/welcome/`) — verify menu labels appear in the configured language, not English.
   4. Load an embedded dashboard (`/embedded/<uuid>/`) — verify any UI strings (including error messages) appear in the configured language.
   5. Verify that if the language pack endpoint is slow or fails entirely, the page still renders correctly in English (no blank screen).
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40729:
URL: https://github.com/apache/superset/pull/40729#issuecomment-4618732251

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #40729:
URL: https://github.com/apache/superset/pull/40729#discussion_r3366040290


##########
superset-frontend/src/embedded/index.tsx:
##########
@@ -172,32 +184,34 @@ function start() {
     method: 'GET',
     endpoint: '/api/v1/me/roles/',
   });
-  return 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;
+      },
+    ),
   );

Review Comment:
   **Suggestion:** `start()` now returns the `pluginsReady` promise but never handles its rejection path. If `setupPlugins()` or `setupCodeOverrides()` throws inside `pluginsReady`, this chain rejects before `getMeWithRole()` runs, producing an unhandled promise rejection and leaving the `started` guard stuck at `true`, so later guest-token retries cannot restart initialization. Add a rejection handler around `pluginsReady` in `start()` that logs/shows an error and resets `started` to allow retry. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Embedded dashboard cannot recover from plugin init failures.
   - ⚠️ Guest token retries ignored due to stuck started flag.
   - ⚠️ Unhandled promise rejection noise in browser console.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Load the embedded dashboard entrypoint `superset-frontend/src/embedded/index.tsx`,
   which defines the `pluginsReady` promise at lines 56–66 by calling
   `initPreamble().catch(...).then(() => { setupPlugins(); setupCodeOverrides({ embedded:
   true }); })`.
   
   2. Observe that `Switchboard.defineMethod('guestToken', ...)` at lines 246–252 calls
   `setupGuestClient(guestToken); start();` and ignores the promise returned by `start()` (no
   `.then`/`.catch` around it).
   
   3. When `start()` runs (line 180), it sets `started = true` (line 182) and returns
   `pluginsReady.then(() => getMeWithRole().then(...))` (lines 187–215); if `setupPlugins()`
   or `setupCodeOverrides()` throws synchronously inside the `pluginsReady` `.then` callback
   (line 63–65), `pluginsReady` rejects and the `pluginsReady.then(() => ...)` chain in
   `start()` also rejects before `getMeWithRole()` is called, with no rejection handler
   attached.
   
   4. Because the rejection is unhandled, the browser logs an unhandled promise rejection,
   the `started` flag remains `true` (only reset in the `getMeWithRole` error handler at
   lines 203–213, which is never reached in this failure mode), and subsequent `guestToken`
   invocations via Switchboard cannot successfully call `start()` again (line 181
   early-returns when `started` is true), leaving the embedded app unable to retry
   initialization.
   ```
   </details>
   
   [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=dc6380ba02774d8ab9551a4883ea0172&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=dc6380ba02774d8ab9551a4883ea0172&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/embedded/index.tsx
   **Line:** 187:215
   **Comment:**
   	*Logic Error: `start()` now returns the `pluginsReady` promise but never handles its rejection path. If `setupPlugins()` or `setupCodeOverrides()` throws inside `pluginsReady`, this chain rejects before `getMeWithRole()` runs, producing an unhandled promise rejection and leaving the `started` guard stuck at `true`, so later guest-token retries cannot restart initialization. Add a rejection handler around `pluginsReady` in `start()` that logs/shows an error and resets `started` to allow retry.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40729&comment_hash=0a03ea61263113cbcdb2ce9acf5a3594edb6e4f0b16967225a1a5c4c8f8b6ae7&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40729&comment_hash=0a03ea61263113cbcdb2ce9acf5a3594edb6e4f0b16967225a1a5c4c8f8b6ae7&reaction=dislike'>👎</a>



-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho merged PR #40729:
URL: https://github.com/apache/superset/pull/40729


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40729:
URL: https://github.com/apache/superset/pull/40729#issuecomment-4734374304

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho closed pull request #40729: fix(i18n): defer plugin init and menu render until language pack is ready
URL: https://github.com/apache/superset/pull/40729


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #40729:
URL: https://github.com/apache/superset/pull/40729#discussion_r3478152691


##########
superset-frontend/src/embedded/index.tsx:
##########
@@ -172,32 +184,34 @@ function start() {
     method: 'GET',
     endpoint: '/api/v1/me/roles/',
   });
-  return 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;
+      },
+    ),
   );

Review Comment:
   +1 agree with this. Probably want to fix this



-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on PR #40729:
URL: https://github.com/apache/superset/pull/40729#issuecomment-4693394543

   > @eschutho I think those screenshots shouldn't be committed
   
   Thanks for catching!


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #40729:
URL: https://github.com/apache/superset/pull/40729#issuecomment-4615439582

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/40729?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `0%` with `22 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 64.01%. Comparing base ([`53e2793`](https://app.codecov.io/gh/apache/superset/commit/53e2793bc3c9c0c3ec272ad55e0394507d5cd510?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`1a42a66`](https://app.codecov.io/gh/apache/superset/commit/1a42a6686cd2d8584e5a3016e9456d1d72920bfe?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 132 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/40729?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset-frontend/src/embedded/index.tsx](https://app.codecov.io/gh/apache/superset/pull/40729?src=pr&el=tree&filepath=superset-frontend%2Fsrc%2Fembedded%2Findex.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2VtYmVkZGVkL2luZGV4LnRzeA==) | 0.00% | [18 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/40729?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset-frontend/src/views/menu.tsx](https://app.codecov.io/gh/apache/superset/pull/40729?src=pr&el=tree&filepath=superset-frontend%2Fsrc%2Fviews%2Fmenu.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL21lbnUudHN4) | 0.00% | [4 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/40729?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #40729      +/-   ##
   ==========================================
   - Coverage   64.01%   64.01%   -0.01%     
   ==========================================
     Files        2594     2594              
     Lines      139898   139906       +8     
     Branches    32470    32470              
   ==========================================
     Hits        89558    89558              
   - Misses      48795    48803       +8     
     Partials     1545     1545              
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/40729/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/40729/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `67.33% <0.00%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/40729?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #40729:
URL: https://github.com/apache/superset/pull/40729#issuecomment-4615358160

   ### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">🔨</span> Latest commit | 1a42a6686cd2d8584e5a3016e9456d1d72920bfe |
   |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a206c668b7b8400089481c4 |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-40729--superset-docs-preview.netlify.app](https://deploy-preview-40729--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTQwNzI5LS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.6TZyneeAznFNm7_iXS0oQB_VStaeJR0jdJW5-ikBiyk)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   |<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#q1YqKMrPLShRslJS0lFKKkrMS84AsjPLEvNKMnVLgPzinMSSzPy8YqB0SmpBTn6lZwpQgVmikYFZspmZRZJ5koWJgYGBhaWJhWGyiVItAA) |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-40729--superset-docs-preview.netlify.app) -->
   _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40729:
URL: https://github.com/apache/superset/pull/40729#issuecomment-4615334802

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #40729:
URL: https://github.com/apache/superset/pull/40729#discussion_r3478152691


##########
superset-frontend/src/embedded/index.tsx:
##########
@@ -172,32 +184,34 @@ function start() {
     method: 'GET',
     endpoint: '/api/v1/me/roles/',
   });
-  return 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;
+      },
+    ),
   );

Review Comment:
   +1 agree with this. Probably want to fix this. Maybe we should see if we can have a test validate this?



-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #40729:
URL: https://github.com/apache/superset/pull/40729#issuecomment-4747034234

   @eschutho the eager dynamic-import approach looks right and resolves @kgabryje's static-import race. Only loose end: the two `.github/pr-screenshots/*.png` are still in the diff — drop those and I think this is good to go.


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40729:
URL: https://github.com/apache/superset/pull/40729#issuecomment-4636606380

   <!-- Bito Reply -->
   The flagged issue is correct. The `pluginsReady` promise chain in `start()` lacks a rejection handler, which causes unhandled promise rejections and prevents the `started` flag from being reset if `setupPlugins()` or `setupCodeOverrides()` fails. This effectively locks the embedded dashboard in a failed state.
   
   To resolve this, you should attach a `.catch()` handler to the `pluginsReady` promise chain within `start()` to log the error and reset the `started` flag, allowing for retries.
   
   ### Proposed Fix
   
   In `superset-frontend/src/embedded/index.tsx`, update the `start()` function as follows:
   
   ```typescript
     return pluginsReady
       .catch(err => {
         logging.error('Plugin initialization failed', err);
         started = false;
         showFailureMessage(t('Failed to initialize plugins.'));
       })
       .then(() =>
         getMeWithRole().then(
           ({ result }) => {
             // ... existing success logic
           },
           err => {
             // ... existing error logic
             started = false;
           },
         ),
       );
   ```
   
   Would you like me to check the rest of the comments on this PR and implement fixes for them as well?
   
   **superset-frontend/src/embedded/index.tsx**
   ```
   return pluginsReady
       .catch(err => {
         logging.error('Plugin initialization failed', err);
         started = false;
         showFailureMessage(t('Failed to initialize plugins.'));
       })
       .then(() =>
         getMeWithRole().then(
           ({ result }) => {
             // ... existing success logic
           },
           err => {
             // ... existing error logic
             started = false;
           },
         ),
       );
   ```


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40729:
URL: https://github.com/apache/superset/pull/40729#issuecomment-4637230427

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(i18n): defer plugin init and menu render until language pack is ready [superset]

Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on PR #40729:
URL: https://github.com/apache/superset/pull/40729#issuecomment-4671206019

   @eschutho I think those screenshots shouldn't be committed


-- 
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-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org