Skip to content

Preserve questionnaire JSON and editor state - #8

Draft
PSchmiedmayer wants to merge 16 commits into
anvil-editor-packagesfrom
anvil-authoring-correctness
Draft

PSchmiedmayer wants to merge 16 commits into
anvil-editor-packagesfrom
anvil-authoring-correctness

Conversation

@PSchmiedmayer

Copy link
Copy Markdown
Member

♻️ Current situation & Problem

Importing JSON into an object can round FHIR decimals and discard source formatting.
Embedded editing also needs to keep unsaved drafts, external findings and preview answers associated with the document they belong to.

Tracked in #5.

⚙️ Release Notes

  • Preserve imported JSON tokens for retained values across edits, item moves, undo and redo.
  • Preserve unknown members in object exports and isolate stored document snapshots from caller edits.
  • Associate external findings with their store and revision, reject saves from stale JSON drafts and keep preview answers with their items.
  • Preserve exact JSON in standalone import, autosave and export, and let hosts provide their own JSON editor.

📚 Documentation

The core README describes text-backed stores, the text export API and editing constraints.
The React README describes revision-scoped findings, save notifications and showJsonPanel.

✅ Testing

Cover precise decimals and line endings, moves, copies, undo and redo, stale drafts, store replacement and delayed preview input.
Verify a clean npm ci and npm run validate on the assembled candidate and run the raw-editing and standalone import and export flows in a native browser.

Code of Conduct & Contributing Guidelines

@PSchmiedmayer
PSchmiedmayer added this pull request to stack #9 December 3, 2026 21:24
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…ange

The carried tests follow the exact source behavior: imports keep their source texts, the store keeps its own copy of the input, the JSON panel loads text directly, and single-answer preview items keep one answer. New Core, React, and app tests cover source layout detection, source edits, raw extension shapes, and storage and import edge cases.
The cases share one describe block like the other Core tests and import the parser from the package entry point.
The panel loads its text as one Questionnaire, so a Bundle fails with a shape error. It now says to use Import for Bundles, as before the exact source change, and keeps the shape error for other resource types.
The JSON panel shows the hint for a Bundle with a single entry too and leaves the document unchanged.
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