Skip to content

Upgrade React to 19, additional major dependency updates (Primer, TanStack, tRPC) #412

Open

Description

@wrslatz

Is your feature request related to a problem?

Current versions of React, Primer, TanStack, and tRPC are all outdated.

Describe the solution you'd like

When #409 merges and the project is updated to Next.js 16, these dependencies can then be updated.

Detailed migration plan

Current State

Package Current Version Target Version
React 18.3.1 19.x
React DOM 18.3.1 19.x
@primer/react 36.27.0 38.x
@primer/octicons-react 19.15.2 Latest
@tanstack/react-query 4.36.1 5.x
@trpc/client 10.45.3 11.x
@trpc/react-query 10.45.3 11.x
@trpc/server 10.45.3 11.x
styled-components 5.3.11 6.x

Migration Steps

1. Upgrade React to v19

npm install react@19 react-dom@19
npm install -D @types/react@19 @types/react-dom@19

Breaking Changes:

Impact: Low - this codebase does not use useFormState or useFormStatus

2. Upgrade styled-components to v6

npm install styled-components@6
npm uninstall @types/styled-components # Types are bundled in v6

Breaking Changes:

Impact: Low - mostly internal changes

3. Upgrade @tanstack/react-query to v5

Run codemod first:

npx @tanstack/react-query-codemod@latest v5/all src/

Then install:

npm install @tanstack/react-query@5

Breaking Changes:

Files to review after codemod:

  • src/providers/TRPCProvider.tsx
  • Any files using tRPC queries/mutations

4. Upgrade @trpc to v11

Run codemod first:

npx @trpc/codemod@latest v11 src/

Then install:

npm install @trpc/client@11 @trpc/react-query@11 @trpc/server@11

Breaking Changes:

Files to review after codemod:

  • src/server/trpc.ts - tRPC initialization
  • src/server/routers/ - Router definitions
  • src/app/api/trpc/[trpc]/route.tsx - tRPC route handler
  • src/utils/trpc.ts - tRPC client

5. Upgrade @primer/react to v38

npm install @primer/react@38 @primer/octicons-react@latest

Breaking Changes:

  • Component API changes
  • Theme/color system updates
  • Some components moved from drafts to main export (or vice versa)
  • See https://github.com/primer/react/blob/main/CHANGELOG.md
  • See Primer React v37 Release
  • See Primer React v38 Release
    • Removed dependency on styled-components, so project needs to adapt to new styling approach

      We’ve removed our dependency on the end-of-life library styled-components. This means some component styling will need to change:

      • The sx prop is no longer supported. You can style components by providing a className and using CSS Modules.
      • Props from styled-system are no longer available.
      • Support for theming in JavaScript has been removed.

Files to review:

  • src/app/page.tsx
  • src/app/[organizationId]/page.tsx
  • src/app/[organizationId]/forks/[forkId]/page.tsx
  • src/app/not-found.tsx
  • src/app/components/dialog/*.tsx
  • src/app/components/header/*.tsx
  • src/app/components/loading/Loading.tsx
  • src/app/components/search/*.tsx

Note: We already migrated from internal lib-esm paths to public export paths (@primer/react and @primer/react/drafts) as part of the Next.js 16 upgrade (TODO: link PR once raised externally), which should reduce the migration effort.

Post-Upgrade Tasks

  1. Enable Turbopack for builds - After upgrading @primer/react to v38, test if Turbopack works and remove the --webpack flag from the build script
  2. Run full test suite - Verify all tests pass
  3. Manual testing - Test the application end-to-end

Acceptance Criteria

  • React upgraded to v19
  • styled-components upgraded to v6
  • @tanstack/react-query upgraded to v5
  • @trpc packages upgraded to v11
  • @primer/react upgraded to v38
  • All tests pass
  • Build succeeds (ideally with Turbopack)
  • Application functions correctly in development and production

References

Describe alternatives you've considered

No response

Additional context

No response

Activity

  1. added theissue type on Apr 30, 2026
  2. self-assigned this
    on Sep 11, 2026
  3. Miablo commented on Sep 11, 2026

    @Miablo
    Contributor

    @wrslatz -- thought on this proposed split for this issue

    I dug into this and think this could be 4 PRs rather than one big migration: partly for review-ability, and partly because npm's peer-dep constraints force a different order than the one above.

    Why

    • @primer/react@36.27.0 pins react: ^18.0.0 and styled-components: 5.x as hard peer deps. React 19 cannot be installed while Primer stays on v36. it'll fail peer resolution.
    • @primer/react@38 accepts react: 18.x || 19.x, so it can be upgraded first, on React 18, decoupling it from the React bump.
    • @trpc/react-query@11 requires @tanstack/react-query@^5.67+, while @trpc/react-query@10.45.3 requires ^4.18.0. React Query v5 and tRPC v11 are mutually pinned and must ship in the same PR. So neither can move alone without breaking the other's peer dep.

    Proposed PRs (in order)

    1. @primer/react v38 + @primer/octicons-react (React stays on 18)
    2. React 19 + @types/react/@types/react-dom
    3. @tanstack/react-query v5 + @trpc/client/@trpc/react-query/@trpc/server v11
    4. styled-components

    PR 1 and PR 3 are independent of each other and could be parallelized by two people; PR 2 depends on PR 1 landing first.

    If this looks good to you I get started on PR 1 and make sure to link these all to this issue or I can create sub-issues to treat this one as an epic!

  4. wrslatz commented on Sep 11, 2026

    @wrslatz
    ContributorAuthor

    Makes sense to me! Thanks, @Miablo!

  5. Miablo commented on Sep 13, 2026

    @Miablo
    Contributor

    PR 1: #505

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions