fix(render): surface an error for misconfigured/unhandled renderer tags instead of "[object Object]" - #2892
Merged
mtoy-googly-moogly merged 1 commit intoJun 16, 2026
Conversation
…gs instead of "[object Object]"
A field whose renderer tag resolves to a renderer name that no plugin handles fell through apply-renderer's default branch to String(value); for a structured (record/array) value that produced the literal "[object Object]" filling the result panel. A common case: a child-only `# big_value { sparkline=... }` placed on a view with no activating `# big_value` (the plugin declines to match since malloydata#2719). The Malloy lint already flags this, but render time showed garbage.
- When the renderer validator has already flagged the field (e.g. the big_value case), surface its specific message ("Tag 'big_value' on field 'root' is only valid on basic fields inside big_value.") so the user sees exactly what is wrong. FieldBase records error-severity validateFieldTags findings; apply-renderer's default reads them.
- Otherwise, for a structured value with no renderer, surface a generic "no renderer available" message inline. Scalars and the 'none' renderAs keep the existing string fallback, so a chart-child record is not mistaken for an error and one unhandled field does not blank the whole panel.
- render.tsx: the ErrorBoundary fallback now resolves the message from an {error} wrapper, a thrown Error, or a raw string, fixing a pre-existing bug where thrown render errors showed an empty red box.
Adds a misconfigured-big_value Storybook story and a render-validator test.
Combines malloydata#2874 (Sagar) and malloydata#2875 (Monty).
Co-authored-by: Sagar Swami Rao Kulkarni <sagarswamirao@gmail.com>
Signed-off-by: Monty Lennie <montylennie@gmail.com>
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.
Combines #2874 (Sagar) and #2875 (Monty) into one change, closing both.
A field whose renderer tag resolves to a renderer name that no plugin handles fell through
apply-renderer'sdefaultbranch toString(value). For a structured (record/array) value that produced the literal[object Object]filling the result panel. A common case: a child-only# big_value { sparkline=... }placed on a view with no activating# big_value(the plugin correctly declines to match since #2719). The Malloy lint already flags this, but render time showed garbage. Separately, once an error was thrown the ErrorBoundary rendered an empty red box rather than the message.Changes
FieldBaserecords error-severityvalidateFieldTagsfindings;apply-renderer'sdefaultreads them.nonerenderAs keep the existing string fallback, so a chart-child record is not mistaken for an error and one unhandled field does not blank the whole panel.render.tsx: the ErrorBoundary fallback now resolves the message from a thrownErroror a raw string, fixing a pre-existing bug where thrown render errors showed an empty red box (affects all render-time error display).docs/validation.md: documents the new inline render-time surfacing of producer-Drilling for Date and time fields #1 errors.Before / after
Testing
jest --selectProjects malloy-renderpasses; added arender-validatortest for the exact view-level# big_value { sparkline=... }shape.misconfigured_big_valueStorybook story; verified via headless screenshots that the misconfig shows the specific error and that table / line / bar / dashboard / list / pivot / valid big_value stories are unaffected (the generic branch never false-fires on legit renderers or thenonechart-child case).Note for reviewers
This surfaces the error two ways depending on how the renderer fails: a plugin throw still routes to
ErrorPlugin(unchanged); a plugin decline that leaves a field with no renderer but which the validator has flagged now shows that logged error inline rather than[object Object]. I considered rerouting the decline case through a plugin throw or a setup-timeErrorPlugininjection instead, but the throw path losesvalidateFieldTagscoverage for "renders + one setting wrong" cases (e.g.# big_value { size=lg sparkline=x }, which should render and log, not red-box), and a setup-time injection would have to mirror the built-in renderer list to avoid replacing valid cell/dashboard renders. Flagging since it touches the validation contract; happy to take the decline case down a different route if you'd prefer.A companion change in malloydata/publisher validates these tags at package-load time so a misconfigured tag also fails publish with a clear error rather than only surfacing at render time.