Repository navigation
feat(onboarding): expose hasUnsavedChanges on the daily schedule edit state - #1594
Merged
Merged
Conversation
… state Add hasUnsavedChanges (draft vs saved schedule) and hasDifferencesFromCountryDefault (same value as isDirty, clearer name) so custom UIs can tell whether closing would discard edits. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
📦 Bundle Size Report
Size Limits
Largest Files (Top 5)
View All Files (291 total)
✅ Bundle size check passed |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
|
Deploy preview for adp-cost-calculator ready!
Deployed with vercel-action |
Contributor
|
Deploy preview for remote-flows ready!
Deployed with vercel-action |
…edule form and demo Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
📊 Coverage Report✅ Coverage increased! 🎉
Detailed BreakdownLines Coverage
Statements Coverage
Functions Coverage
Branches Coverage
✅ Coverage check passed |
…ule change flags A saved break like "030" is rebuilt as "30", so hasUnsavedChanges stayed true after saving. Move the flag tests into DailySchedule.test.tsx and cover save(), unchecked days and break edits. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ad3c132. Configure here.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ule flags An empty break was compared as 0, so clearing a saved 0-minute break left hasUnsavedChanges and hasDifferencesFromCountryDefault false even though the field is required and closing would restore 0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…hedule edit state Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…tom daily schedule Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
jordividaller
approved these changes
Oct 16, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Custom daily schedule editors can now tell whether closing the editor would discard edits, and read the saved and draft weekly totals straight from the edit state.
Why
isDirtycompares the draft against the country default, not against the saved schedule. A partner building their own "Discard changes?" prompt can't use it: it is true when nothing was edited but a custom schedule is saved, and false after editing back to the default.close()discards edits silently, so partners need a reliable signal. Partners also had to recalculate the weekly totals themselves to show a live total next to the saved one.What changed
Toggle details
Public API (additive only, no breaking change) on
DailyScheduleEditState:hasUnsavedChanges: the draft differs from the saved schedule (or from the default when nothing is saved).hasDifferencesFromCountryDefault: same value asisDirty, under a name that says what it compares against.draftWeeklyHours/savedWeeklyHours: weekly totals of the draft and of the saved schedule. They followsubtractBreaksFromWorkHoursand are0while a time is incomplete, like the per-rowhours.isDirtyis unchanged; only its JSDoc now says what it compares against.Internally the existing default-comparison helper was generalised to
isSameScheduleand reused for both comparisons. Break minutes are compared as numbers, so a saved "030" doesn't read as changed, but a cleared break is never equal to a saved0.The prebuilt edit form reads
hasDifferencesFromCountryDefault. The custom example now also shows the draft and saved totals and asks for confirmation before discarding whenhasUnsavedChangesis true.Screenshots
N/A
Related Resources
Testing
Flag tests live in
DailySchedule.test.tsx: saved custom schedule, editing start time and break, toggling a day, edits to an unchecked day, clearing a saved 0-minute break,close(),reset(),save()(including a break with leading zeros), and the saved vs draft weekly totals.Removing the saved-schedule comparison makes six of the flag tests fail, computing
savedWeeklyHoursfrom the draft rows makes the weekly totals test fail, and the previous numeric-only break comparison makes the 0-minute-break test fail. I confirmed each and restored the code.example/app in a browser🤖 Generated with Claude Code
Note
Low Risk
Additive public API on onboarding schedule editing with clarified semantics;
isDirtybehavior is unchanged and covered by new tests.Overview
Extends the headless Daily Schedule edit API so custom UIs can distinguish draft vs saved from draft vs country default, and show weekly totals without reimplementing math.
DailyScheduleEditStategainshasUnsavedChanges(closing would discard edits),hasDifferencesFromCountryDefault(same meaning as existingisDirty, now documented), plusdraftWeeklyHoursandsavedWeeklyHours. The built-in form and example use the explicit default flag for Reset to default; the example also prompts on cancel/close whenhasUnsavedChangesis true and displays draft vs saved weekly hours.Comparison logic is generalized to
isSameSchedule, with break minutes compared numerically (e.g.030vs30) and edits on unchecked days ignored for unsaved detection. New tests cover these flags through edit, toggle,close(),reset(), andsave().Reviewed by Cursor Bugbot for commit 24b3c57. Bugbot is set up for automated code reviews on this repo. Configure here.