frontend: plugins: Show error notification when plugin loading fails - #6351
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes plugin-load failures user-visible by replacing a silent .catch(console.error) in the frontend plugin loader with an error handler that logs the failure and shows an error snackbar. It also adds the corresponding i18n string across locales so the message is translatable (and can fall back to English where untranslated).
Changes:
- Show an error snackbar when
fetchAndExecutePlugins()rejects infrontend/src/plugin/Plugins.tsx. - Add the new “Failed to load plugins…” translation key across locale
translation.jsonfiles. - Regenerate/sort locale
glossary.jsonentries (e.g., moving “Logs: {{ itemName }}” to a different position).
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/plugin/Plugins.tsx | Replace bare .catch(console.error) with an error handler that enqueues an error snackbar. |
| frontend/src/i18n/locales/ar/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/ar/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/bn/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/bn/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/de/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/de/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/en/translation.json | Add the new plugin-load-failure translation key (English source string). |
| frontend/src/i18n/locales/en/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/es/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/es/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/fr/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/fr/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/he/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/he/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/hi/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/hi/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/it/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/it/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/ja/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/ja/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/ko/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/ko/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/pt/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/pt/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/ru/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/ru/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/ta/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/ta/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/ur/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/ur/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/zh/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/zh/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
| frontend/src/i18n/locales/zh-tw/translation.json | Add the new plugin-load-failure translation key. |
| frontend/src/i18n/locales/zh-tw/glossary.json | Regenerated glossary ordering/entries (includes moving “Logs: {{ itemName }}”). |
|
Good catch — I missed that index.ts does Promise.reject(resp) in a few places, so err isn't always an Error. Changed the type to unknown in the latest commit. |
illume
left a comment
There was a problem hiding this comment.
Thanks for these changes.
Can you please address the open review comments? Once you've resolved each one, please mark it as resolved.
|
Fixed. |
illume
left a comment
There was a problem hiding this comment.
Thanks for this.
I wonder if you saw this error, or how you found it?
Could you please add a test case?
|
|
illume
left a comment
There was a problem hiding this comment.
Thanks for these changes.
Can you please have a look at the git commits to see if they meet the contribution guidelines? We use a Linux kernel style of git commits. See the contributing guide for general context, and please see previous git commits with git log for examples.
Commits that need attention
frontend: plugins: add test for error snackbar and restore inline comment— Description must start with a capital letter — e.g.frontend: HomeButton: Fix the buttonnotfrontend: HomeButton: fix the button.
Commit guidelines
- Use atomic commits focused on a single change.
- Use the title format
<area>: <Description of changes>— description must start with a capital letter. - Keep the title under 72 characters (soft requirement).
- Explain the intention and why the change is needed.
- Make commit titles meaningful and describe what changed.
- Do not add code that a later commit rewrites; squash or reorder commits instead.
- Do not include
Fixes #NNin commit messages.
Good examples:
frontend: HomeButton: Fix so it navigates to homebackend: config: Add enable-dynamic-clusters flag
When fetchAndExecutePlugins() rejects (e.g. the backend is unreachable), the error was silently swallowed by a bare .catch(console.error). Users had no indication that plugin loading had failed. Replace it with a handler that logs the error with context and shows an error snackbar via enqueueSnackbar(), matching the pattern used elsewhere in the codebase for user-visible fetch failures. The .catch() is placed before .finally() so the error handler does not run on a clean load, and the finally block is wrapped in try/catch so a dispatch failure cannot escape silently. Add the new translation string across all locale files.
Add Plugins.test.tsx with two cases: one that checks an error snackbar is shown when fetchAndExecutePlugins rejects, and one that checks no error snackbar fires on a successful load.
6a00a84 to
e206252
Compare
|
Done — squashed all the fixup commits into two clean commits and removed the issue reference from the commit body. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: illume, krsatyamthakur-droid The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Previously, if fetchAndExecutePlugins() rejected (e.g. the backend was
unreachable), the error was silently swallowed by a bare .catch(console.error).
Users had no indication that plugins failed to load.
Replace it with a handler that logs the error and displays an error
snackbar via enqueueSnackbar(), matching the pattern used elsewhere in
the codebase for user-visible fetch failures.
Summary
When plugin loading fails, users now see an error snackbar instead of
nothing. The fix replaces the bare
.catch(console.error)with a handlerthat both logs and surfaces the error to the user.
Related Issue
Fixes #6349
Changes
frontend/src/plugin/Plugins.tsx: replaced.catch(console.error)witha handler that logs the error and calls
enqueueSnackbar()withvariant: 'error'npm run i18nSteps to Test
frontend/src/plugin/index.ts, temporarily makefetchAndExecutePluginsthrow (e.g. add
throw new Error('test')at the top of the function)Screenshots (if applicable)
N/A — the change is a snackbar that only appears on failure
Notes for the Reviewer
translation|namespace prefix conventionalready used in Plugins.tsx for the incompatible plugins warning
npm run i18n; non-Englishentries are placeholder strings that translation contributors can fill in