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

chore: Componetize Tokens screen #11471

Merged
merged 39 commits into from
Oct 4, 2024
Merged

Conversation

gambinish
Copy link
Contributor

@gambinish gambinish commented Sep 27, 2024

Description

Proposal: Break up monolithic Tokens/index.tsx file into smaller, more maintainable components.

As I began working on my Token sorting task, I noticed that the Tokens screen code structure felt overly flat, which led to some challenges navigating through the logic (~800 lines). The reliance on multiple internal callbacks created lots of complexity, making it difficult to reason through the flow, and unclear where to reliably and maintainably introduce my sorting logic.

In this PR, I’m proposing a refactor of the screen by breaking it down into smaller, more manageable components, with a utility directory to handle non TSX related helpers (like sorting or handling balances). So, instead of relying heavily on internal callbacks, we can just pass props and utilize selectors where needed for each component’s specific function.

While this may be a matter of personal preference, I believe that an over-reliance on internal callbacks can often result in a bit of an anti-pattern. I feel that this refactor will make these components more straightforward, reliable, and easier to maintain. Is there a reason why we wouldn't want to go with this approach instead?

I also realize that we have other tasks in-flight and I don't want to be a blocker, but I feel pretty strongly that this refactor will remove lots of technical debt and set us up really well for the long run.

Note: This isn't quite complete, and you'll notice a few areas where I can do things like tighten up TypeScript types. If you folks are fine with this approach, I can go ahead and polish this.

Related issues

Fixes:

Manual testing steps

  1. Go to tokens page, ensure that all functionality remains unchanged.

Screenshots/Recordings

Screen.Recording.2024-09-26.at.9.31.15.PM.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@gambinish gambinish added the No QA Needed Apply this label when your PR does not need any QA effort. label Sep 27, 2024
@gambinish gambinish added Run Smoke E2E Triggers smoke e2e on Bitrise and removed No QA Needed Apply this label when your PR does not need any QA effort. labels Sep 27, 2024
Copy link
Contributor

github-actions bot commented Sep 27, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 0fd9ad5
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/74dd5d29-646c-4896-a8c8-100933bf4d0f

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@gambinish gambinish marked this pull request as ready for review September 30, 2024 17:00
@gambinish gambinish requested a review from a team as a code owner September 30, 2024 17:00
@gambinish gambinish removed the Run Smoke E2E Triggers smoke e2e on Bitrise label Sep 30, 2024
@gambinish gambinish added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 1, 2024
Copy link
Contributor

github-actions bot commented Oct 1, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 7f6ce57
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/958211fb-3a64-40f7-9e67-1eb20d7d1b2c

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@gambinish gambinish added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 1, 2024
Copy link
Contributor

github-actions bot commented Oct 1, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: a531043
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/bcef0b66-7a95-416d-9abe-d03e4f8c2b03

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@gambinish gambinish added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 2, 2024
Copy link
Contributor

github-actions bot commented Oct 2, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 560a0a9
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/90098835-9f87-499d-8a9b-7978a7e8746c

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

Copy link
Contributor

@vinnyhoward vinnyhoward left a comment

Choose a reason for hiding this comment

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

Overall it LGTM✅

Copy link
Contributor

@NicolasMassart NicolasMassart left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@gambinish gambinish requested a review from a team as a code owner October 4, 2024 05:11
@gambinish gambinish added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 4, 2024
Copy link
Contributor

github-actions bot commented Oct 4, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 3e8c909
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/0269243a-fc12-498c-940e-49cb2a3d24da

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Copy link

sonarcloud bot commented Oct 4, 2024

@gambinish gambinish added this pull request to the merge queue Oct 4, 2024
Merged via the queue into main with commit b3befd8 Oct 4, 2024
43 checks passed
@gambinish gambinish deleted the chore/componetize-tokens-screen branch October 4, 2024 06:01
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Run Smoke E2E Triggers smoke e2e on Bitrise team-assets
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants