-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add task priority and estimated time #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
- Add priority field (P1-P4) with color coding similar to Todoist - Add estimated_time field (in minutes) for task duration estimation - Both fields are optional - Update backend: model, migration, GraphQL types, resolvers - Update frontend: UI components, queries, display with color coding - Priority colors: P1 (red), P2 (orange), P3 (yellow), P4 (blue) Implements #30 and #31
- Include priority and estimatedTime in UpdateTask mutation response - Include current priority value when persisting estimatedTime changes - Prevents priority from being reset when updating estimated time
- Update formData directly from mutation response instead of relying on refetch - Remove refetch() call from persistChanges to avoid race conditions - Make useEffect smarter to only update when data actually changes - Prevents input fields from resetting after updates
2f88700 to
874c238
Compare
- Fix null/undefined checks in TaskDetailView useEffect - Remove trailing spaces - Fix React Hook dependency array - All linting errors resolved
Root cause: refetchInterval and useEffect were overwriting local edits Solution: - Track dirty fields with useRef to prevent overwriting fields being edited - Use React Query cache updates instead of refetch() to avoid race conditions - Update cache directly from mutation responses - Only merge server data with local state, preserving dirty fields - Mark fields as dirty when user starts editing - Clear dirty flags after successful mutation This ensures: - Every field update persists immediately to backend - Form state never resets when moving between fields - Server updates don't overwrite local edits in progress
- Add patient field to UpdateTask mutation response - Fix cache update to merge instead of replace, preserving all fields - Ensure formData preserves patientId when updating other fields - Fix TypeScript types for cache update function This fixes the issue where patient name disappeared when updating priority
…validation Root cause: Cache invalidation and refetchInterval were overwriting recently updated fields Solution: - Track field update timestamps with fieldUpdateTimestampsRef - Add 5-second grace period to preserve recently updated fields - Enhance shouldPreserveField to check both dirty flags and timestamps - Explicitly preserve priority and estimatedTime in cache merge (even if null) - Set timestamps before mutation and in mutation onSuccess This prevents: - Priority/estimatedTime reset when queryClient.invalidateQueries() is called - Fields being overwritten by refetchInterval (3s) after updates - Race conditions between mutations and refetches
…to null Root cause: When optional fields are null, server returns null and we overwrite form state Solution: - Always check shouldPreserveField before overwriting priority/estimatedTime - Preserve fields in final return statement even when hasDirtyFields is false - Improve cache merge to explicitly check for field presence - Handle null values correctly in comparisons This ensures: - Priority/estimatedTime never reset to null after being set - Grace period protection works even when server returns null - Fields are preserved during refetch/cache invalidation cycles
…skInput Root cause: Optional fields defaulted to None, making it impossible to distinguish between 'field not provided' and 'field set to null' Solution: - Change priority and estimated_time defaults to strawberry.UNSET in UpdateTaskInput - This allows backend to correctly handle: - Field not provided: strawberry.UNSET -> don't update - Field set to null: None -> update to null - Field set to value: TaskPriority/int -> update to value This ensures: - Priority/estimatedTime persist correctly when set - Fields can be explicitly cleared by setting to null - Other fields can be updated without affecting priority/estimatedTime
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.
Which issues does this pull request close?
closes #30 #31
[OPTIONAL] Give testing instructions to reviewers