Skip to content

[BUG] - JSON preview throws on invalid JSON instead of showing a local validation state #951

@modelorona

Description

@modelorona

Describe the bug
The editor's JSON preview path still calls JSON.parse(value) during render. Invalid JSON can throw and trip the top-level error boundary instead of showing a local validation message.

To Reproduce

  1. Open a JSON editor view.
  2. Enter invalid JSON.
  3. Switch to preview.
  4. Observe that the page can crash instead of showing an inline preview error.

Expected behavior
Invalid JSON should show a local preview error state, not crash the app shell.

Screenshots
N/A

Desktop (please complete the following information):

  • OS that WhoDB is running on: N/A
  • How you're running WhoDB: Source-reviewed frontend issue
  • Browser: N/A
  • Version: N/A

Smartphone (please complete the following information):

  • Device: N/A
  • OS: N/A
  • Browser: N/A
  • Version: N/A

Additional context
Area: Frontend CE

Evidence:

  • frontend/src/components/editor.tsx:377-397

Acceptance Criteria:

  • Preview mode never throws for malformed JSON.
  • Invalid JSON shows a readable local validation message.
  • The error boundary is not triggered by malformed preview input.
  • Valid JSON preview still renders as before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogbugSomething isn't workinggood first issueGood for newcomersjavascriptPull requests that update Javascript code

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions