fix(web-ui): render localized setup-field labels in the plugin config drawer - #917
Merged
Merged
Conversation
… drawer
Clicking "Config" on a plugin attached to an orchestrator replaced the whole
page with the route error boundary ("Etwas ist schiefgelaufen").
Root cause: since #602 (OM-17) the manifest loader normalises every setup
field's `label` and `help` into a `{ <locale>: text }` map (`?? { en: key }`).
PluginsDnd still rendered `field.label` straight into JSX, which is React #31
("Objects are not valid as a React child (found: object with keys {en})"). It
threw on the first render after the drawer opened, so the error propagated to
app/error.tsx and took the orchestrator page down.
This was not an edge case: 192 of 192 setup fields across 27 plugins in the
live catalog are maps — not one ships a bare string. Every plugin with setup
fields was unconfigurable from the orchestrator page.
- PluginsDnd resolves label/help with `pickLocalized` (the same helper the
store's setup form and credentials editor already use), falling back to the
field key exactly as the loader does.
- `PluginSetupFieldDto` typed `label`/`help` as plain strings, which is what
let the mismatch through typecheck; both are now `LocalizedMarkdown | string`.
- `pickLocalized` now returns a bare string as-is. Without that branch a
payload from a pre-#602 middleware would fall through to
`Object.values('abc')` and render 'a'.
Regression test drives the button and asserts the map resolves, the active
locale wins, a bare string still renders, and an empty map falls back to the
key. Reverting the render change fails three of the four with React #31.
…onfig-drawer-localized-labels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Clicking Config on a plugin attached to an orchestrator (
/operator/agents/<slug>) replaced the entire page with the route error boundary — „Etwas ist schiefgelaufen".Reproduced live on
odoo-bot-harness.fly.dev; the captured console error is unambiguous:Root cause
Since #602 (OM-17)
manifestLoadernormalises every setup field'slabelandhelpinto a{ <locale>: text }map (normalizeLocalized(f['label']) ?? { en: key }). The store's setup form and credentials editor were updated to resolve those withpickLocalized.PluginsDndwas not — it still renderedfield.labelstraight into JSX, which is React #31 "Objects are not valid as a React child". The throw happens on the first render after the drawer opens, so it propagates toapp/error.tsx.PluginSetupFieldDtodeclaredlabel: string/help?: string, which is precisely why typecheck never caught the drift against the real payload.This was not an edge case. Scanning the live
/plugin-catalogresponse: 192 of 192 setup fields across 27 plugins are maps — not a single one ships a bare string. Every plugin with setup fields was unconfigurable from the orchestrator page.Changes
PluginsDnd.tsxlabel/helpviapickLocalized(…, useLocale()), falling back tofield.keyexactly as the loader does_lib/agents.tsPluginSetupFieldDto.label/help→LocalizedMarkdown | string_lib/localized.tspickLocalizedreturns a bare string as-is — without that branch a pre-#602 payload would fall through toObject.values('abc')and render'a'__tests__/PluginsDnd.localizedFields.test.tsxTest plan
npm run typecheckcleannpm run lint— 0 errors (52 pre-existing warnings)npm run i18n:check— OK, 4086 keysNo new user-facing strings; the labels come from plugin manifests, so no
messages/*.jsonchange is involved.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.