Closed srosenberg74 closed 2 years ago
This seems to have fixed the issue referenced by the bug ticket. However, there are still issues if a user adds an expense while already viewing another expense's details and then goes back to the expense that they were already viewing. However, I'm not sure if that is the intended behavior for the app, that a user could add an expense while already viewing the details of another one. Also not sure if that would be considered a new bug or related to this one.
Changes
Purpose This was done so that if a user wants to edit an expense a second time, after already editing it once, the information for the expense still shows up in the form.
Approach Initially, every time a user edited an expense the label was reset. Now, the label is not reset if the user wants to re-edit the same expense. This was accomplished by removing the code that automatically reset the label when an expense is edited, but this necessitated adding a way to reset the label whenever a new expense is added, so I also added the useEffect. However, I found a bug with this solution and found it overly complex, so I removed the useEffect and added a conditional to the value property of the
<TextInput>
for the label instead.Learning Focused on trying to use a solution that didn't add unnecessary complexity to the app and that required the least amount of change to the code base while hopefully accomplishing the necessary fix.
Closes #123