Skip to content

feat(framework-editor): Save as Draft / Save and Commit (FRAME-4)#3129

Merged
tofikwest merged 1 commit into
mainfrom
tofik/frame-4-save-draft-and-commit
Jun 12, 2026
Merged

feat(framework-editor): Save as Draft / Save and Commit (FRAME-4)#3129
tofikwest merged 1 commit into
mainfrom
tofik/frame-4-save-draft-and-commit

Conversation

@tofikwest

@tofikwest tofikwest commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What

Replaces the single Commit Changes button on the requirements editor with the three buttons Joe asked for: Cancel, Save as Draft, Save and Commit.

Why (FRAME-4, interpretation A)

Per Joe's confirmation of interpretation A:

  • Cancel — discard the uncommitted grid edits (unchanged behaviour).
  • Save as Draft — persist edits to the live framework templates without publishing. This is exactly what "Commit Changes" did before — your edits are saved but not yet released to customers.
  • Save and Commit — persist edits, then open the Publish Version dialog so the accumulated changes go out as a new published version.

This matches Joe's "5 drafts then commit = 6 changes committed": each Save-as-Draft persists edits as you go, and the final Save-and-Commit publishes a version containing everything.

Changes

  • FrameworkRequirementsClientPage: three-button toolbar; Save and Commit runs the save then opens PublishVersionDialog — but only if the save succeeded (so we never publish a half-saved state). Reuses useFrameworkVersions for the next-version suggestion (same as the Versions tab).
  • useRequirementChangeTracking.handleCommit now returns boolean (true when every edit persisted) so the publish step can be chained safely. Existing callers (onClick={handleCommit}) are unaffected.

No API or DB changes — reuses the existing publish endpoint + dialog.

Testing

  • New FrameworkRequirementsClientPage.toolbar.test.tsx (4 tests): all three buttons render when dirty; Save-as-Draft commits without opening publish; Save-and-Commit commits then opens publish; publish stays closed when the save fails.
  • Updated …expandable.test.tsx with mocks for the new imports.
  • turbo typecheck --filter=@trycompai/framework-editor: clean.

Worth a quick click-through on the preview (Save as Draft, then Save and Commit → publish dialog).

🤖 Generated with Claude Code


Summary by cubic

Adds Cancel, Save as Draft, and Save and Commit to the requirements editor to match FRAME-4 (interpretation A). Save as Draft saves edits without publishing; Save and Commit saves then opens the publish dialog to release a new version.

  • New Features
    • Three-button toolbar: Cancel discards local edits.
    • Save as Draft: persists edits to live templates without publishing.
    • Save and Commit: saves, then opens PublishVersionDialog only on success; uses useFrameworkVersions for next-version suggestion.
    • handleCommit now returns a boolean to signal save success; existing callers remain compatible.
    • No API or DB changes.

Written for commit bb7064b. Summary will update on new commits.

Review in cubic

@linear

linear Bot commented Jun 12, 2026

Copy link
Copy Markdown

FRAME-4

@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comp-framework-editor Ready Ready Preview, Comment Jun 12, 2026 7:03pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
app Skipped Skipped Jun 12, 2026 7:03pm
portal Skipped Skipped Jun 12, 2026 7:03pm

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Linked issue analysis

Linked issue: FRAME-4: Framework Editor - Requirements->Description

Status Acceptance criteria Notes
Render three buttons labeled: Cancel, Save as Draft, Save and Commit The toolbar was updated to show the three buttons and the tests assert each button is present when dirty.
Cancel discards uncommitted edits (unchanged behaviour) Cancel is wired to the existing handleCancel from useRequirementChangeTracking and the PR does not change that behavior.
Save as Draft persists edits without opening the publish dialog Save as Draft calls handleCommit (the existing persist action) and tests verify the commit runs and the publish dialog remains closed.
Save and Commit persists edits then opens the Publish Version dialog only when the save succeeds (and stays closed on failure) A new handleSaveAndCommit awaits handleCommit and opens PublishVersionDialog only if the save returned success. Tests cover both the success path (opens publish) and failure path (stays closed).
⚠️ Accumulation behavior: repeated Save as Draft calls accumulate and the final Save and Commit publishes the accumulated changes (e.g. “5 drafts then commit = 6 changes committed”) The implementation and tests show that Save as Draft persists edits and Save and Commit publishes after a successful save, which supports the interpreted accumulation behavior, but there is no explicit test that simulates multiple draft saves and verifies the published version contains all accumulated changes.

Re-trigger cubic

Replaces the single "Commit Changes" button with the three buttons Joe asked
for (FRAME-4, interpretation A):

- Cancel — discard the uncommitted grid edits (unchanged).
- Save as Draft — persist edits to the live templates without publishing
  (the previous "Commit Changes" behaviour).
- Save and Commit — persist edits, then open the Publish Version dialog so the
  accumulated changes go out as a new version. Publish only opens when every
  edit saved cleanly.

handleCommit now returns whether the save succeeded so Save-and-Commit can
chain the publish step safely. Reuses the existing PublishVersionDialog and
useFrameworkVersions (for the next-version suggestion).

Closes FRAME-4

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tofikwest tofikwest force-pushed the tofik/frame-4-save-draft-and-commit branch from b691ec6 to bb7064b Compare June 12, 2026 19:02
@vercel vercel Bot temporarily deployed to Preview – portal June 12, 2026 19:02 Inactive
@vercel vercel Bot temporarily deployed to Preview – app June 12, 2026 19:02 Inactive
@tofikwest tofikwest merged commit 094cae0 into main Jun 12, 2026
9 checks passed
@tofikwest tofikwest deleted the tofik/frame-4-save-draft-and-commit branch June 12, 2026 19:08
@claudfuen

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.82.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants