Conversation
Current Code Coverage Percent of this PR:99.52 %Files having coverage below 100%
|
shivamsinghchahar
left a comment
There was a problem hiding this comment.
@gowsik-ragunath Please look at the comments below
| setShowAddMemberDialog: any; | ||
| addedMembers: any; | ||
| projectId: number; | ||
| projectId: any; |
There was a problem hiding this comment.
I assume this would be a string or number, why any?
There was a problem hiding this comment.
Changed to number.
| const [projectToEdit, setProjectToEdit] = useState({}); | ||
| const [projectToDelete, setProjectToDelete] = useState({}); |
There was a problem hiding this comment.
Is it possible to combine this into a single state? say selectedProject?
There was a problem hiding this comment.
Combined both the state into a single state selectedProject.
| const getProject = async () => { | ||
| const data = await projectApi.show(projectData.id); | ||
| setEditProjectData(data.data.project_details); | ||
| }; |
There was a problem hiding this comment.
use try/catch and also have a loading state.
There was a problem hiding this comment.
Added try-catch block with promise
| const deleteProject = async project => { | ||
| await projectApi.destroy(project.id); | ||
| setTimeout(() => { | ||
| setShowDeleteDialog(false); | ||
| window.location.reload(); | ||
| }, 500); | ||
| }; |
There was a problem hiding this comment.
Same suggestion as above
There was a problem hiding this comment.
Also, why are we reloading the window?
There was a problem hiding this comment.
@shivamsinghchahar I re-used the delete client component to follow the same flow, in that instead of refetching clients the page is refreshed to list the clients present in that company.
Do we need to avoid reloading this page?
There was a problem hiding this comment.
I see, we shouldn't be reloading the page like this. But fine, let's keep it like this for now because this will need fixing in both the places. We can handle it in a separate ticket.
cc// @supriya3105
|
@gowsik-ragunath Please work on the review comments |
* Fixed the project edit and delete options in client details and project list page * Added exception handling to api calls * Added try catch block with promise Co-authored-by: Akhil G Krishnan <[email protected]> Co-authored-by: Gowsik <[email protected]>
Notion card
Summary
Fixed the edit and delete project modal in client detail and project list pages.
Preview
https://www.loom.com/share/e285067b8e874e9f861766285175bba3
Type of change
Please delete options that are not relevant.
not work as expected)
How Has This Been Tested?
Checklist: