fix(i18n): reset embedded start guard and align menu error handling#41491
fix(i18n): reset embedded start guard and align menu error handling#41491rusackas wants to merge 4 commits into
Conversation
Code Review Agent Run #582f3eActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
The flagged issue is correct. The current implementation of To resolve this, you should refactor // 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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #41491 +/- ##
==========================================
+ Coverage 64.70% 64.72% +0.01%
==========================================
Files 2686 2686
Lines 148625 148637 +12
Branches 34298 34298
==========================================
+ Hits 96164 96198 +34
+ Misses 50696 50674 -22
Partials 1765 1765
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Code Review Agent Run #80e280Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
@rusackas It seems like we are missing regression coverage for the two failure paths you added in A targeted Jest test should force |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #573ee4Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Adds a rejection handler to the pluginsReady promise chain in the embedded start() so a throw from setupPlugins() or setupCodeOverrides() resets the started guard and logs the error, preventing embedded dashboards from getting stuck in a failed state. Aligns the empty .catch in menu.tsx with the try/finally + logging.error pattern used in views/index.tsx. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A transient failure loading or running the plugin setup left the module-level pluginsReady promise permanently rejected, so resetting the started guard alone could not recover: a retry chained off the same rejected promise. Recreate it on failure so a rehandshake actually re-runs plugin initialization. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Attach a no-op rejection handler when (re)creating pluginsReady so a rejection that settles before the next start() attaches its handler doesn't surface as an unhandled-rejection warning. start() still handles the rejection itself. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cdd1588 to
80b40fe
Compare
Add regression coverage for the two failure paths this PR touches: the embedded start() guard resetting and recreating pluginsReady so a retry re-runs plugin setup, and the menu still rendering (and logging) when initPreamble() rejects or render throws. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@sadpandajoe Good call — added Jest coverage for both: |
Code Review Agent Run #f8269eActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Follow-up to #40729.
That PR deferred plugin init and menu render until the language pack is ready, but left two rough edges in the error handling that this tightens up.
SUMMARY
embedded/index.tsx:start()chains off thepluginsReadypromise, but that chain had no rejection handler. IfsetupPlugins()orsetupCodeOverrides()throws,pluginsReadyrejects, the chain rejects unhandled, and thestartedguard staystrueforever, so a retry just returns early and the embedded dashboard is stuck in a failed state. This adds a rejection handler to thepluginsReady.then(...)instart()that logs the error and resetsstarted = falseso a rehandshake can retry, mirroring the existing guest-token failure path.menu.tsx: replaces the empty.catch(() => {})with the sametry/finally+logging.errorpattern already used inviews/index.tsx, so the menu still always renders (import/render infinally) but unexpected failures get logged instead of swallowed.No behavior change on the happy path; this only hardens the failure paths.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (error-path hardening, no visual change).
TESTING INSTRUCTIONS
setupPlugins()/setupCodeOverrides()and confirm the error is logged andstartedresets so a retry can proceed, rather than the dashboard hanging.initPreamble()to reject and confirm the menu still renders (in English) and any unexpected render error is logged.ADDITIONAL INFORMATION
🤖 Generated with Claude Code