Skip to content

web: fix white-screen on non-root classes; trim wasted right-pane margin; add error boundary#31

Merged
stevevanhooser merged 1 commit into
mainfrom
claude/document-schema-viewer-editor-JJ7PI
May 14, 2026
Merged

web: fix white-screen on non-root classes; trim wasted right-pane margin; add error boundary#31
stevevanhooser merged 1 commit into
mainfrom
claude/document-schema-viewer-editor-JJ7PI

Conversation

@stevevanhooser
Copy link
Copy Markdown
Contributor

Hotfix on top of #30. Two visible bugs and one defensive add.

Fixes

  1. White screen when selecting any non-root class (e.g. app, contrast_tuning).

    Root cause: inside a schema file, document_class.superclasses is an array of {class_name: "base"} objects, not plain strings. The repo's index.json normalizes them to strings, which is why types and the tree builder worked, but Detail.tsx was rendering each ref directly as a React child -- React threw "Objects are not valid as a React child" and unmounted the whole app.

    Fix: add SuperclassRef = string | {class_name, ...} and a superclassName() helper; use it when rendering. The fallback for meta schemas (no document_class) still works because the index entries already give us strings.

  2. Large empty margin between sidebar and content text.

    Leftover main { max-width: 48rem; margin: 0 auto; padding: 2rem 1rem } rule in index.css from the Step 1 placeholder was centering the right pane inside its grid cell. The viewer's right pane is now styled via .content; removed the stale main rule.

  3. Error boundary wrapping the right pane, keyed on the selected class. A future render bug now shows an in-pane error message instead of whiting out the entire app.

Test plan

  • Selecting app (or any class with a superclass) renders the detail view instead of white-screening.
  • Sidebar superclass links on the detail page navigate correctly.
  • Right-pane content sits flush against the sidebar with normal padding (no big empty band).
  • Existing tests still green.

Generated by Claude Code

Inside schema files, document_class.superclasses is an array of
{class_name: "..."} objects, not plain strings (the index.json
normalizes them to strings, hence the mismatch). Detail.tsx was
rendering each ref directly as a React child, throwing "Objects are
not valid as a React child" and unmounting the whole app on any class
that wasn't a root.

- Introduce SuperclassRef = string | {class_name, ...} and a
  superclassName() helper; use it when rendering superclass links.
- Wrap Detail in an ErrorBoundary keyed on selection so a future
  render bug surfaces a message instead of whiting out the page.
- Drop the leftover `main { max-width: 48rem; margin: 0 auto }` rule
  from index.css that was constraining the right pane and leaving
  large empty margins around the content.
@stevevanhooser stevevanhooser merged commit 60b1b04 into main May 14, 2026
5 of 6 checks passed
@stevevanhooser stevevanhooser deleted the claude/document-schema-viewer-editor-JJ7PI branch May 14, 2026 10:24
stevevanhooser added a commit that referenced this pull request May 14, 2026
… NDIcalc-vis updates)

Absorbs main commits 03d9925..988a795. Brings in:
- V_delta NDIcalc-vis aggregation + tuning conversion docs (orientation_direction, speed, contrast, SF/TF)
- pyproject setuptools auto-discovery fix (PR #29 prep)
- web/ scaffold: Vite + React + TypeScript schema viewer (PRs #29, #30, #31, #33)
- .github/workflows/deploy-web.yml: GitHub Pages deploy for the web viewer

Note: the step-6 commit 03d9925 is already merged into main (via PR #27), so
this sync is a fast-forward in tree terms. All step-6 changes (the 4
ontology-collapse conversion markdowns, _universal_renames.md, schema_version
on base, class_version resets, V_delta_SPEC/notes edits, regenerated index.json)
are preserved verbatim in main and therefore on this branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants