fix: persist project/task changes when editing a time entry#209
Merged
Conversation
The edit modal's reset effect re-ran whenever selectedProject/selectedTask changed in the store, which happened mid-edit and clobbered the user's new selection. Submitting also only forwarded hours/notes, so even visual edits to project/task were silently dropped. A BC line is bound to one project+task, so a project/task change now replaces the entry (delete + add) instead of attempting an in-place patch. Fixes #208. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an issue in the timesheet time-entry edit modal where changing project/task selections would revert and where project/task updates were not persisted to Business Central. The PR also aligns edit behavior with BC’s constraint that a timesheet line is bound to a single project+task by treating project/task changes as a replacement operation.
Changes:
- Prevent the modal “reset form” effect from re-running on project/task selection changes (fixes selection snapping back).
- Persist project/task edits by replacing the original entry (delete + create) when project/task changes; keep in-place update behavior for hours/notes/date-only edits.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Replace eslint-disable on the reset effect with a resetKey ref so the body still re-runs on background projects refreshes, just not on incidental dep churn from selectProject/selectTask. - Create the replacement entry before deleting the original when project or task changes, so a BC failure mid-flight no longer risks losing the user's original hours and notes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Surface a specific toast and close the modal when the post-add delete fails, so the user knows the original line still exists and needs to be removed manually rather than seeing a generic save error. - Correct the reset-effect comment to match the actual guard behavior: the resetKey ref intentionally skips background dep changes (including projects refreshes) to protect in-progress edits, not to forward them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
BenGWeeks
approved these changes
Jun 4, 2026
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
selectedProject/selectedTask(and friends) in deps, so picking a new project mid-edit firedselectProject→ re-ran the effect → snapped the form back to the original entry values.handleSubmitonly forwardedhours/noteson update — project and task changes were silently dropped even when the UI did show them.Fixes #208
Test plan
🤖 Generated with Claude Code