Skip to content

Wallet Disconnects on Reload after Route Change in React App with thirdweb v5.105.16 #7654

@Mustafa-Siddique

Description

@Mustafa-Siddique

When using thirdweb v5.105.16 in a React app with react-router v7, the wallet connection (MetaMask, Rainbow, and social logins) is lost after navigating to a different route and reloading the page. This occurs despite following all recommended setup and troubleshooting steps.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a React app with thirdweb/react v5.105.16 and react-router v7.7.0.
  2. Place at the root of the app, wrapping the router.
  3. Use directly under or inside the component consisting connect button.
  4. Connect a wallet (MetaMask, Rainbow, or social login).
  5. Navigate to a different route.
  6. Reload the page.
  7. Observe that the wallet is disconnected.

Expected behavior
The wallet connection should persist across route changes and page reloads, as per thirdweb v5 best practices.

Troubleshooting steps already performed

  • wraps the entire app, including the router.
  • No duplicate providers in the component tree.
  • is present directly under .
  • No key prop or logic causing to remount.
  • No code clearing localStorage or sessionStorage.
  • Observed thirdweb wallet keys in local storage after connecting; on reload, keys either disappear or wallet disconnects.
  • Created a minimal app with just , , and router; issue persists.
  • No relevant warnings or errors in the browser console during navigation or reload.

Additional context

  • No custom state management or logic interfering with thirdweb provider.
  • Issue occurs with multiple wallets and social login options.
  • All recommended thirdweb v5 best practices have been followed.

Check this out: https://github.com/user-attachments/assets/646ac35f-bdf9-4e3c-a278-01bf8d835556

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions