Fix for direct addition of custom exercise from Diary page.#672
Fix for direct addition of custom exercise from Diary page.#672CodeWithCJ merged 4 commits intomainfrom
Conversation
Summary of ChangesHello @CodeWithCJ, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug preventing the direct addition of custom exercises from the Diary page due to an incorrect ID assignment. By modifying the exercise creation process to utilize the actual ID returned from the backend, the system now ensures that newly added custom exercises are properly identified and integrated, enhancing the user experience and data integrity. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The changes in this pull request correctly address the issue where a temporary ID was being used when adding a custom exercise from the Diary page. By capturing the actual exercise object returned from the server and passing it to the onExerciseAdded callback, the application now uses the correct database-generated ID, preventing potential errors in subsequent operations. The code is cleaner and more robust after removing the placeholder logic. I have noted one minor improvement regarding state management in the review comments to ensure the form is fully cleared after a successful addition.
| 'custom' | ||
| ); | ||
|
|
||
| onExerciseAdded(createdExercise, 'custom'); |
There was a problem hiding this comment.
While updating this function to use the returned exercise, I noticed that the manualCaloriesPerHour state is not reset along with the other form fields at the end of the handleAddCustomExercise function (lines 150-163). Consider adding setManualCaloriesPerHour(undefined); to the reset logic to ensure the form is fully cleared for the next time the dialog is opened.
#560
Fix for direct addition of custom exercise from Diary page. Adjusted UUID to it doesn't error out due to dummy text id for the exercise