Skip to content

Fix inconsistent dirty state validation between staging and non-staging modes#1012

Merged
karilint merged 2 commits intocodex/plan-feature-to-disable-finalize-entry-buttonfrom
copilot/sub-pr-1011
Dec 9, 2025
Merged

Fix inconsistent dirty state validation between staging and non-staging modes#1012
karilint merged 2 commits intocodex/plan-feature-to-disable-finalize-entry-buttonfrom
copilot/sub-pr-1011

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 9, 2025

The WriteButton component enforced dirty state validation inconsistently: in non-staging mode the button was disabled when no edits existed, but in staging mode it remained enabled and showed a notification on click.

Changes

  • Unified button disable logic: Applied !isDirty check uniformly across all modes instead of only non-staging (!mode.staging && !isDirty)
  • Updated test expectations: Changed staging mode test from verifying notification behavior to verifying button is disabled when not dirty

The finalizeEntry guard remains as defensive programming despite the button now preventing clicks when not dirty.

// Before: inconsistent between modes
disabled={Object.keys(fieldsWithErrors).length > 0 || (!mode.staging && !isDirty)}

// After: consistent validation
disabled={Object.keys(fieldsWithErrors).length > 0 || !isDirty}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: karilint <19990676+karilint@users.noreply.github.com>
Copilot AI changed the title [WIP] Add dirty state tracking to detail context Fix inconsistent dirty state validation between staging and non-staging modes Dec 9, 2025
Copilot AI requested a review from karilint December 9, 2025 11:19
Copy link
Copy Markdown
Contributor

@karilint karilint left a comment

Choose a reason for hiding this comment

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

LGTM

@karilint karilint marked this pull request as ready for review December 9, 2025 11:36
@karilint karilint merged commit 2125413 into codex/plan-feature-to-disable-finalize-entry-button Dec 9, 2025
@karilint karilint deleted the copilot/sub-pr-1011 branch December 9, 2025 11:37
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.

2 participants