Skip to content

fix(ui): keep an unnamed class out of the schema removal preview, one at a time - #782

Merged
JArmandoAnaya merged 1 commit into
mainfrom
fix/schema-blank-class
Aug 25, 2026
Merged

fix(ui): keep an unnamed class out of the schema removal preview, one at a time#782
JArmandoAnaya merged 1 commit into
mainfrom
fix/schema-blank-class

Conversation

@JArmandoAnaya

Copy link
Copy Markdown
Contributor

What changed

Deleting a class in the Schema tab previews the remaining draft through POST /schema/preview. That body is publish-shaped, and the kernel refuses a blank class name, so with two or more unnamed classes every delete surfaced as "Could not preview this change · The request payload is not processable". The kernel and the wire are right and untouched; the editor was sending an unpublishable document to a publish-shaped endpoint.

  • SchemaEditor.tsx: a class with no name was never published and cannot carry annotations, so removing it is a local edit with no request; removing a named class previews the named classes only.
  • Add class adds nothing while a class is still unnamed — it selects that class, clears the filter, and says "Name the new class first", the remedy Save already uses for the same blank. Typing a name unblocks it; no save is required. The gate is on the name only, because a new class always carries box and the picker never lets the last shape be unticked.
  • docs/content/ui.md: the schema-editor section states the rule.

Found, not fixed

Nothing.

Test plan

  • vitest on screens.test.tsx + schemaDraft.test.tsx: 129 pass. Three new cases — blank removal sends no preview, named removal sends only the named classes, second Add is refused until the first is named — each proven to fail with the fix stashed.
  • pnpm --filter @visionset/ui-core lint
  • CI: Playwright suites and the rest of the matrix

… at a time

Deleting a class previews the remaining draft through POST /schema/preview,
whose body is publish-shaped and refuses a blank name. With two unnamed
classes the leftover one turned every delete into a 422 alert. A class with
no name was never published and cannot carry annotations, so removing it is
a local edit; removing a named class previews the named classes only.

Add class now adds nothing while a class is still unnamed: it selects that
class and says so, the remedy Save already uses for the same blank.
@JArmandoAnaya
JArmandoAnaya merged commit 8c32873 into main Aug 25, 2026
15 checks passed
@JArmandoAnaya
JArmandoAnaya deleted the fix/schema-blank-class branch August 25, 2026 17:15
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