Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix client edit modal#329

Merged
vipulnsward merged 8 commits intodevelopfrom
fix-client-edit-modal
Apr 26, 2022
Merged

Fix client edit modal#329
vipulnsward merged 8 commits intodevelopfrom
fix-client-edit-modal

Conversation

@gowsik-ragunath
Copy link
Contributor

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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Checklist:

  • I have manually tested all workflows
  • I have performed a self-review of my own code
  • I have added automated tests for my code

@github-actions
Copy link

Current Code Coverage Percent of this PR:

99.52 %

Files having coverage below 100%

Impacted Files Coverage
/app/controllers/invoices_controller.rb 63.64 %

Copy link
Contributor

@shivamsinghchahar shivamsinghchahar left a comment

Choose a reason for hiding this comment

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

@gowsik-ragunath Please look at the comments below

setShowAddMemberDialog: any;
addedMembers: any;
projectId: number;
projectId: any;
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this would be a string or number, why any?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to number.

Comment on lines 34 to 35
const [projectToEdit, setProjectToEdit] = useState({});
const [projectToDelete, setProjectToDelete] = useState({});
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to combine this into a single state? say selectedProject?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Combined both the state into a single state selectedProject.

Comment on lines 17 to 20
const getProject = async () => {
const data = await projectApi.show(projectData.id);
setEditProjectData(data.data.project_details);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

use try/catch and also have a loading state.

const [status, setStatus] = React.useState<InvoicesStatus>(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added try-catch block with promise

Comment on lines 10 to 16
const deleteProject = async project => {
await projectApi.destroy(project.id);
setTimeout(() => {
setShowDeleteDialog(false);
window.location.reload();
}, 500);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Same suggestion as above

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, why are we reloading the window?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@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?

Copy link
Contributor

Choose a reason for hiding this comment

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

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

@supriya3105
Copy link
Contributor

@gowsik-ragunath Please work on the review comments

@vipulnsward vipulnsward merged commit 23e4ec4 into develop Apr 26, 2022
@vipulnsward vipulnsward deleted the fix-client-edit-modal branch April 26, 2022 12:37
vipulnsward pushed a commit that referenced this pull request Feb 15, 2026
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants