[PR #1066] [MERGED] react-router 6 upgrade #3498

Closed
opened 2026-02-28 20:42:31 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/1066
Author: @trevdor
Created: 5/28/2023
Status: Merged
Merged: 6/23/2023
Merged by: @j-f1

Base: masterHead: trevdor-react-router-6-part-2


📝 Commits (10+)

  • 5b8f076 Upgrade to react-router-dom v6
  • cfcb6c3 useHistory -> useNavigate
  • 5b581db activeStyle -> style and remove a withRouter
  • e74435b Release notes
  • fe5606b Remove RouteComponentProps: not available in RR6
  • 74a13b6 Disable menu item actions for now
  • 55717ab Replace __history with __navigate
  • 8042721 effect
  • 186a17d Add in import
  • 4dc5ac7 Remove createLocation usage

📊 Changes

40 files changed (+678 additions, -798 deletions)

View changed files

📝 packages/desktop-client/package.json (+1 -3)
📝 packages/desktop-client/src/components/FinancesApp.js (+158 -190)
📝 packages/desktop-client/src/components/FloatableSidebar.js (+4 -7)
📝 packages/desktop-client/src/components/GlobalKeys.js (+6 -6)
📝 packages/desktop-client/src/components/LoggedInUser.js (+4 -5)
📝 packages/desktop-client/src/components/Modals.js (+202 -189)
📝 packages/desktop-client/src/components/Page.js (+3 -3)
📝 packages/desktop-client/src/components/SidebarWithData.js (+13 -15)
📝 packages/desktop-client/src/components/Titlebar.js (+32 -26)
📝 packages/desktop-client/src/components/accounts/Account.js (+13 -7)
📝 packages/desktop-client/src/components/accounts/MobileAccount.js (+1 -2)
📝 packages/desktop-client/src/components/accounts/MobileAccounts.js (+1 -1)
📝 packages/desktop-client/src/components/accounts/TransactionList.js (+5 -8)
📝 packages/desktop-client/src/components/budget/index.js (+4 -4)
📝 packages/desktop-client/src/components/common.tsx (+19 -30)
📝 packages/desktop-client/src/components/manager/ConfigServer.js (+8 -8)
📝 packages/desktop-client/src/components/manager/ManagementApp.js (+41 -55)
📝 packages/desktop-client/src/components/manager/Modals.js (+1 -12)
📝 packages/desktop-client/src/components/manager/subscribe/ChangePassword.tsx (+4 -4)
📝 packages/desktop-client/src/components/manager/subscribe/Error.tsx (+3 -3)

...and 20 more files

📄 Description

Nearly-complete upgrade to v6 conventions, following this guide.

Draft because I'm struggling to finish (short on time and not sure I understand the full purpose of the particular way history is manipulated in Actual).
But this upgrade feels important to complete before I move to mobile transaction entry, which will likely bring a new set of routes on top of what we have.

Remaining Work

  • Remove all direct usage of the history package. (3 spots left)
    • 2 createBrowserHistory and 1 createLocation
    • tricky bit: our patchedHistory, made available globally window (search window.__history to find usages)
    • Is RouterProvider the RR6 replacement for this? But will it do all we were doing with our global patched history? (See Note below)
  • Find a replacement type for RouteComponentProps in common.tsx
  • Regression test ButtonLink since it had its withRouter removed

Bugs

  • Transaction data not refreshing as you transition between accounts
  • Mobile: individual account ledgers not loading (/account/:id)

Note

mis-remembered. Disregard
Our global undo feature appears meant to take you back to the route you were at for the undone step. (e.g. you change a transaction in /account/<uuid>, visit the Budget page, then press CMD+Z -- you should jump back to /account/<uuid> -- honestly, I suspect we've broken this over the past several months, but haven't pinpointed when)

Closes #822


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/1066 **Author:** [@trevdor](https://github.com/trevdor) **Created:** 5/28/2023 **Status:** ✅ Merged **Merged:** 6/23/2023 **Merged by:** [@j-f1](https://github.com/j-f1) **Base:** `master` ← **Head:** `trevdor-react-router-6-part-2` --- ### 📝 Commits (10+) - [`5b8f076`](https://github.com/actualbudget/actual/commit/5b8f076acec8c20293edbaa9bce326b3e52bb027) Upgrade to react-router-dom v6 - [`cfcb6c3`](https://github.com/actualbudget/actual/commit/cfcb6c32dce8063e297231a0c0f529b877de2e23) useHistory -> useNavigate - [`5b581db`](https://github.com/actualbudget/actual/commit/5b581db37931dd99d097c0e16d3770265ede61c7) activeStyle -> style and remove a withRouter - [`e74435b`](https://github.com/actualbudget/actual/commit/e74435b934479e24f6e5620cf95e80a55244f5f5) Release notes - [`fe5606b`](https://github.com/actualbudget/actual/commit/fe5606b8faaaead2d6bcefd80497b8998722e678) Remove RouteComponentProps: not available in RR6 - [`74a13b6`](https://github.com/actualbudget/actual/commit/74a13b65b35afa06a4cb19c0186def211f33c4d6) Disable menu item actions for now - [`55717ab`](https://github.com/actualbudget/actual/commit/55717abc5dec956b01a4e7604a5cf59d84068959) Replace __history with __navigate - [`8042721`](https://github.com/actualbudget/actual/commit/8042721c1c6908190cdeb2b245b6a14c29fb569a) effect - [`186a17d`](https://github.com/actualbudget/actual/commit/186a17d649a5d591918f2cf595bb41aa063037f9) Add in import - [`4dc5ac7`](https://github.com/actualbudget/actual/commit/4dc5ac7ec118e8b3edc766d5f64e9bd195f7152e) Remove createLocation usage ### 📊 Changes **40 files changed** (+678 additions, -798 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/package.json` (+1 -3) 📝 `packages/desktop-client/src/components/FinancesApp.js` (+158 -190) 📝 `packages/desktop-client/src/components/FloatableSidebar.js` (+4 -7) 📝 `packages/desktop-client/src/components/GlobalKeys.js` (+6 -6) 📝 `packages/desktop-client/src/components/LoggedInUser.js` (+4 -5) 📝 `packages/desktop-client/src/components/Modals.js` (+202 -189) 📝 `packages/desktop-client/src/components/Page.js` (+3 -3) 📝 `packages/desktop-client/src/components/SidebarWithData.js` (+13 -15) 📝 `packages/desktop-client/src/components/Titlebar.js` (+32 -26) 📝 `packages/desktop-client/src/components/accounts/Account.js` (+13 -7) 📝 `packages/desktop-client/src/components/accounts/MobileAccount.js` (+1 -2) 📝 `packages/desktop-client/src/components/accounts/MobileAccounts.js` (+1 -1) 📝 `packages/desktop-client/src/components/accounts/TransactionList.js` (+5 -8) 📝 `packages/desktop-client/src/components/budget/index.js` (+4 -4) 📝 `packages/desktop-client/src/components/common.tsx` (+19 -30) 📝 `packages/desktop-client/src/components/manager/ConfigServer.js` (+8 -8) 📝 `packages/desktop-client/src/components/manager/ManagementApp.js` (+41 -55) 📝 `packages/desktop-client/src/components/manager/Modals.js` (+1 -12) 📝 `packages/desktop-client/src/components/manager/subscribe/ChangePassword.tsx` (+4 -4) 📝 `packages/desktop-client/src/components/manager/subscribe/Error.tsx` (+3 -3) _...and 20 more files_ </details> ### 📄 Description Nearly-complete upgrade to v6 conventions, following [this guide](https://reactrouter.com/en/main/upgrading/v5#upgrade-to-react-router-v6). Draft because I'm struggling to finish (short on time and not sure I understand the full purpose of the particular way `history` is manipulated in Actual). But this upgrade feels important to complete before I move to mobile transaction entry, which will likely bring a new set of routes on top of what we have. ### Remaining Work - [x] Remove all direct usage of the `history` package. (3 spots left) * 2 `createBrowserHistory` and 1 `createLocation` * tricky bit: our `patchedHistory`, made available globally `window` (search `window.__history` to find usages) * Is `RouterProvider` the RR6 replacement for this? But will it do all we were doing with our global patched history? (See Note below) - [x] Find a replacement type for `RouteComponentProps` in [common.tsx](https://github.com/actualbudget/actual/pull/1066/files#diff-db00a4331c3d9b4705f5e89a2719873651418d5118565e5084ad4341c984b422R17) - [x] Regression test ButtonLink since it had its `withRouter` removed **Bugs** - [x] Transaction data not refreshing as you transition between accounts - [ ] Mobile: individual account ledgers not loading (`/account/:id`) ### Note _mis-remembered. Disregard_ ~~Our global undo feature appears meant to take you back to the route you were at for the undone step. (e.g. you change a transaction in `/account/<uuid>`, visit the Budget page, then press CMD+Z -- you should jump back to `/account/<uuid>` -- honestly, I suspect we've broken this over the past several months, but haven't pinpointed when)~~ Closes #822 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 20:42:31 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#3498