Skip to content
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

refactor: AddressDetailExplorer to fn component #317

Merged
merged 5 commits into from
Oct 25, 2024

Conversation

tuliomir
Copy link
Contributor

@tuliomir tuliomir commented Sep 13, 2024

Acceptance Criteria

  • Refactors the AddressDetailExplorer to functional component

Motivation

This component used the deprecated withRouter connector, which will become unavailable in the coming upgrade to React Router v6.

In order to remove its usage, it was necessary to refactor it to use react hooks as a functional component. This proved to be harder than initially foreseen because the code relied heavily upon async state setters, a feature that is also no longer available with useState() hooks.

So, instead of setting the state, waiting for it to be rendered and then applying the next set of instructions, the code now sets the state and then a useEffect() handles its change. Many data flow reorganizations were made to achieve this new structure.

Note for the reviewers

Since this component is so complex and had deep changes to its data flow, I'd recommend checking the before and after versions of the code to understand the changes made.

Security Checklist

  • Make sure you do not include new dependencies in the project unless strictly necessary and do not include dev-dependencies as production ones. More dependencies increase the possibility of one of them being hijacked and affecting us.

@tuliomir tuliomir self-assigned this Sep 13, 2024
@tuliomir tuliomir mentioned this pull request Sep 17, 2024
1 task
src/components/AddressDetailExplorer.js Outdated Show resolved Hide resolved
src/components/AddressDetailExplorer.js Outdated Show resolved Hide resolved
src/components/AddressDetailExplorer.js Show resolved Hide resolved
src/components/AddressDetailExplorer.js Show resolved Hide resolved
src/components/AddressDetailExplorer.js Show resolved Hide resolved
alexruzenhack
alexruzenhack previously approved these changes Sep 17, 2024
src/components/AddressDetailExplorer.js Show resolved Hide resolved
src/components/AddressDetailExplorer.js Show resolved Hide resolved
src/components/AddressDetailExplorer.js Show resolved Hide resolved
@tuliomir tuliomir merged commit 635b3fb into dev Oct 25, 2024
1 check passed
@tuliomir tuliomir deleted the refactor/address-detail-fn branch October 25, 2024 22:16
@tuliomir tuliomir mentioned this pull request Oct 30, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Waiting to be deployed
Development

Successfully merging this pull request may close these issues.

3 participants