Skip to content

Conversation

@mulikruchi07
Copy link
Contributor

Description

This PR fixes an issue where the Start Date selected while editing a task was not being saved.
The root cause was that startValue in DetailRouteController.initValues() was always being set to null, preventing the UI from loading the existing start value and causing saves to fail silently.

This update ensures:
startValue is initialized correctly from modify.draft.start
The selected Start Date persists after saving
The Start Date appears correctly when returning to the task detail screen

No additional dependencies required.

Fixes #515

Screenshots

after.515.mp4

Checklist

  • Tests have been added or updated to cover the changes
  • Documentation has been updated to reflect the changes
  • Code follows the established coding style guidelines
  • All tests are passing

Copilot AI review requested due to automatic review settings December 7, 2025 14:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical bug where the Start Date field was not being saved when editing a task. The root cause was an incorrect initialization statement in DetailRouteController.initValues() that used ??= null, which is a no-op that always results in null assignment. The fix changes this to a direct assignment from modify.draft.start, making it consistent with all other date field initializations (end, due, wait, until).

Key Changes:

  • Fixed startValue initialization in initValues() to properly load the existing start date from the task draft
  • Ensured start date persistence across save operations and UI reloads
Comments suppressed due to low confidence (1)

lib/app/modules/detailRoute/controllers/detail_route_controller.dart:118

  • The initValues() method and the start date initialization bug fix lack test coverage. Consider adding unit tests for DetailRouteController.initValues() to verify that all draft fields (including startValue) are correctly initialized from modify.draft, and that the start date persists correctly through save and reload operations. This would prevent similar regressions in the future.
  void initValues() {
    descriptionValue.value = modify.draft.description;
    statusValue.value = modify.draft.status;
    entryValue.value = modify.draft.entry;
    modifiedValue.value = modify.draft.modified;
    startValue.value = modify.draft.start; //start date saves
    endValue.value = modify.draft.end;
    dueValue.value = modify.draft.due;
    waitValue.value = modify.draft.wait;
    untilValue.value = modify.draft.until;
    priorityValue?.value = modify.draft.priority;
    projectValue?.value = modify.draft.project;
    tagsValue?.value = modify.draft.tags;
    urgencyValue.value = urgency(modify.draft);
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@linuxcaffe
Copy link

linuxcaffe commented Dec 7, 2025 via email

@linuxcaffe
Copy link

See #419

@mulikruchi07
Copy link
Contributor Author

mulikruchi07 commented Dec 7, 2025

Thanks for the clarification
I’ve updated the logic so that:

start no longer auto-sets during task creation
• It remains null until the user explicitly selects a Start date
• When the user selects it in the Edit page, the value now saves correctly
• The explicitly selected value also persists when the task is reopened

I will open a new PR shortly with the corrected implementation.

@mulikruchi07
Copy link
Contributor Author

mulikruchi07 commented Dec 7, 2025

I opened a new PR with the corrected implementation: #517 .
Closing this one to avoid duplication.

@linuxcaffe
Copy link

linuxcaffe commented Dec 8, 2025 via email

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.

Start date value is not saved when editing a task

2 participants