trezor-suite icon indicating copy to clipboard operation
trezor-suite copied to clipboard

React Router upgrade 💪

Open komret opened this issue 4 months ago • 4 comments

This PR upgrades react-router by two major versions. I updated the syntax, but did minimal refactoring, despite the patterns we use are outdated/non-standard.

How we could refactor this in a future PR: The emphasis on hooks in the newer react-router versions encourages developers to access its logic from components. However, Suite handles a lot of - perhaps unnecessarily - complex logic in thunks and duplicates routing data in a reducer. Because of that, I had to introduce the global navigate and location getters and setters, otherwise I'd have to drill them to all of the thunks as arguments. Another issue is that Suite uses legacy hash routing instead of standard URL params which could be accessed via useParams, e.g. /accounts/tokes/hidden#/eth/0/normal instead of accounts/eth/0/normal/tokens/hodden.

QA: Please test anything that comes to your mind related to routing.

Resolves #4649

🔍🖥️ Suite web test results: View in Currents

🔍🖥️ Suite desktop test results: View in Currents

🔍🖥️ Suite native android test results: View in Currents

komret avatar Jun 20 '25 19:06 komret