Skip to content

Phantom does not auto-connect after page refresh in templates with the new Wallet UI. #132

Open
@glendell03

Description

@glendell03

The wallet fails to auto-connect upon refreshing the page.

Steps to Reproduce:

  1. Initialize the project:
npx create-solana-dapp@latest
  1. Select the Next.js template during setup.
  2. Run the development server:
    npm run dev
  1. Open the application in a browser.
  2. Connect a wallet (e.g., Phantom).
  3. Refresh the page.

Expected Behavior:

After refreshing the page, the application should automatically reconnect to the previously connected wallet without requiring user intervention.

Actual Behavior:

Upon refreshing, the wallet disconnects, and the user must manually reconnect.

Screen.Recording.2025-04-24.at.11.49.01.PM.mov
// solana-provider.tsx

'use client'

import dynamic from 'next/dynamic'
import { ReactNode } from 'react'
import { createSolanaDevnet, createSolanaLocalnet, createStorageAccount, createWalletUiConfig, WalletUi,} from '@wallet-ui/react'
import '@wallet-ui/tailwind/index.css'

export const WalletButton = dynamic(async () => (await import('@wallet-ui/react')).WalletUiDropdown, {
  ssr: false,
})
export const ClusterButton = dynamic(async () => (await import('@wallet-ui/react')).WalletUiClusterDropdown, {
  ssr: false,
})

const config = createWalletUiConfig({
  clusters: [createSolanaDevnet(), createSolanaLocalnet()]
})

export function SolanaProvider({ children }: { children: ReactNode }) {
  return <WalletUi config={config}>{children}</WalletUi>
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    known issueThis is a known issue and a fix is pending

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions