Shaheer Sarfaraz 05f1c62de2
Auto save project selection bug (#134)
* fix(tailoring): remove auto-sync effect causing race conditions

Remove the problematic useEffect that was syncing incoming job data
automatically. The effect caused race conditions where user edits were
overwritten after auto-save completed. Now, state only resets when the
job ID changes (user switches to a different job). User edits persist
until explicitly saved.

Fixes #133

* fix(tailoring): remove auto-save from tailor mode

Remove the 1500ms auto-save timeout that was causing race conditions
with the state sync. Users must now explicitly save changes via the
Save Selection button or finalize to persist changes.

* refactor(tailoring): remove draft status state and UI

Remove the draftStatus state and related UI elements that showed
saving/saved/unsaved status. With auto-save removed, this status
indicator is no longer needed. Users now explicitly save via buttons.

* test(tailoring): remove auto-save test

Remove the test that verified auto-save behavior since auto-save
has been removed from the tailor mode. Users now explicitly save
via the Finalize button.

* refactor(tailoring): remove dead focus tracking code

Remove the activeField state and all related focus/blur tracking that
was orphaned after removing auto-sync. The focus tracking was only
used to prevent the auto-sync effect from running while editing.

Changes:
- Remove TailoringActiveField type export
- Remove activeField state and setActiveField from useTailoringDraft
- Remove handleFieldBlur callback from TailoringWorkspace
- Remove onFieldFocus/onFieldBlur props and handlers from TailoringSections

39 lines of dead code removed.

* docs(tailoring): clarify save behavior comment

Update comment to distinguish between editor mode (Save Selection
button) and tailor mode (only persists on finalize). Addresses
review feedback.

* docs(tailoring): clarify useEffect dependencies

Add note explaining why 'job' is included in dependencies despite
the effect being guarded by job.id check. Addresses review feedback
about dependency array clarity.

* fix(tailoring): sync server-normalized values after save

Update persistCurrent and saveChanges to use the returned job from
api.updateJob and call applyIncomingDraft. This ensures local state
stays in sync with server-normalized values (e.g., trimmed fields).

Also removes unused markCurrentAsSaved dependency.

* refactor(tailoring): simplify draft sync effect

Remove unused save snapshot helpers and stop exposing them from the
hook. Track the latest job in a ref and only sync drafts when the job
id changes to avoid unnecessary effect runs while keeping data
correctness.

Addresses review feedback on dependency churn and dead API surface.
2026-02-11 16:18:17 +00:00
..
2026-01-27 23:49:11 +00:00
2026-02-05 19:17:14 +00:00
2026-02-10 22:13:05 +00:00
2026-02-10 22:13:05 +00:00
2026-02-02 21:30:14 +00:00
2026-02-08 01:30:36 +00:00