fix(render): surface an error for unhandled renderer tags instead of "[object Object]" - #2874
Open
sagarswamirao wants to merge 1 commit into
Open
Conversation
…bject Object]"
When a field carries a renderer tag that resolves to a renderer name but no
plugin handles it -- for example `# big_value { sparkline=... }` on a view with
no activating big_value config, where the big_value plugin declines to match --
applyRenderer fell through to its default case and coerced the cell with
String(). For a structured root cell (record/array) that produced
"[object Object]" filling the whole result panel. The Malloy hover/lint already
flags the tag, but running the query rendered garbage.
Two changes:
- apply-renderer: in the default case, render scalar values via String() as
before, but throw a descriptive error for structured (object/array) values
rather than emitting "[object Object]".
- render: the ErrorBoundary fallback receives the thrown error as its first
argument. It read `errorProps.error?.message` and otherwise fell through to
the error object itself, which renders as nothing when used as a JSX child --
an empty error box. Resolve the message from the wrapper, a thrown Error, or a
string, coercing to a string so the message is always displayed.
Backward compatible: scalar values still render exactly as before; only the
previously-broken "[object Object]" path now surfaces a visible error.
Signed-off-by: Sagar Swami Rao Kulkarni <sagarswamirao@gmail.com>
sagarswamirao
force-pushed
the
sagark/render-unhandled-tag-error
branch
from
June 11, 2026 08:17
f296799 to
61b091b
Compare
mtoy-googly-moogly
pushed a commit
that referenced
this pull request
Jun 16, 2026
…gs instead of "[object Object]" (#2892) 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 #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 #2874 (Sagar) and #2875 (Monty). Signed-off-by: Monty Lennie <montylennie@gmail.com> Co-authored-by: Sagar Swami Rao Kulkarni <sagarswamirao@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.
What
When a field carries a renderer tag that resolves to a renderer name but no plugin handles it, the renderer rendered
[object Object](or, once an error was thrown, an empty red error box). This makes both cases surface a clear, inline error message instead.Why
big_valuesupports child-only config keys (e.g.sparkline,comparison_field) that are only valid on a basic field inside an activatedbig_value. If a user instead puts a child-only key on the view itself -- for example:the
big_valueplugin declines to match (child-only config, no activatingbig_valueon the parent), so no plugin attaches to the field. The Malloy hover/lint already flags this as invalid. But at render time:shouldRenderAsstill maps thebig_valuetag torenderAs = 'big_value'.applyRendererfinds no plugin and noswitchcase for'big_value', so it hit thedefaultbranch.String(dataColumn.value). For a structured root cell (a record/array), that produced[object Object]filling the entire result panel.So the hover lint said "this is wrong" but Run SQL rendered garbage. The two should agree -- a misconfigured tag should fail with a visible, actionable error in both places.
While wiring that up, a second, pre-existing bug surfaced: throwing an error produced an empty red box rather than the message. Solid's
ErrorBoundarypasses the thrown error as the first fallback argument, but the fallback readerrorProps.error?.messageand otherwise fell through to the error object itself, which renders as nothing when used as a JSX child. That affected all render-time error display, not just this case.Changes
apply-renderer.tsx-- in thedefaultcase, render scalar values viaString()as before, but throw a descriptive error for structured (object/array) values instead of emitting[object Object].render.tsx-- resolve theErrorBoundarymessage from the{error}wrapper, a thrownError, or a raw string, coercing to a string so the message is always displayed (fixes the empty error box).Compatibility
Backward compatible. Scalar values still render exactly as before; only the previously-broken
[object Object]path now surfaces a visible error, and existing error messages now display instead of an empty box.Test
jest --selectProjects malloy-render-- 92 passed. Verified end-to-end in the VS Code extension: the misconfigured# big_value { sparkline=... }view now showsMalloy render: no renderer available for 'big_value' on field 'root'. Check the 'big_value' tag -- its configuration may be incomplete or unsupported.instead of[object Object].