Skip to content

fix(admin): keep JSON snippets readable after save - #2806

Open
poboll wants to merge 1 commit into
mx-space:masterfrom
poboll:codex/format-json-snippets-on-save-20260811
Open

fix(admin): keep JSON snippets readable after save#2806
poboll wants to merge 1 commit into
mx-space:masterfrom
poboll:codex/format-json-snippets-on-save-20260811

Conversation

@poboll

@poboll poboll commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • format JSON snippets with two-space indentation when they are saved
  • add regression coverage for readable output and invalid JSON handling

Root cause

The snippet editor used JSON.stringify(JSON.parse(raw)) during save. That validation step also collapsed valid JSON into a single line, so reopening the snippet lost the readable structure shown in the editor. The structured snippet conversion path already uses two-space indentation, making the two save paths inconsistent.

Scope

This addresses the JSON snippet formatting regression reported in #2749. The current Admin writing flow has since been substantially revised, so this PR does not claim to close the separate preview and draft-state reports from that issue.

Verification

  • pnpm -C apps/admin exec vitest run src/features/snippets/utils/snippets.normalize.test.ts (2 tests passed)
  • pnpm -C apps/admin run typecheck
  • pnpm -C apps/admin run build
  • ESLint on the changed TypeScript files
  • git diff --check

Related to #2749

@safedep

safedep Bot commented Aug 11, 2026

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

View complete scan results →

This report is generated by SafeDep Github App

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.

1 participant