Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read properties of undefined (reading 'ReactCurrentDispatcher') #903

Open
root9464 opened this issue Dec 27, 2024 · 0 comments

Comments

@root9464
Copy link

Describe the bug

I'm using react 19 and wanted to connect tonconnectui, but I got this error
image
at the same time, the exact same code only on react 18 works correctly in another project.

my code:

//main.tsx
import { GlobalProvider } from '@components/Provider.tsx';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import App from './App.tsx';
import './index.css';

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <GlobalProvider>
      <App />
    </GlobalProvider>
  </StrictMode>,
);

//provider.tsx
'use client';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { TonConnectUIProvider } from '@tonconnect/ui-react';
import { ReactNode } from 'react';

const queryClient = new QueryClient();

export const GlobalProvider = ({ children }: { children: Readonly<ReactNode> }) => {
  return (
    <TonConnectUIProvider manifestUrl={'https://taiga-labs.github.io/gorelko.json'}>
      <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
    </TonConnectUIProvider>
  );
};

//app.tsx

import { Header } from '@components/Header';
import { StatsModule } from '@modules/Stats/Module';
import { SwapModule } from '@modules/Swap/Module';

export default function App() {
  return (
    <div className='h-full w-full px-[15px] py-5'>
      <Header />
      <SwapModule />
      <StatsModule />
    </div>
  );
}

To reproduce

  1. take react 19
  2. connect tonconnectui
  3. observe the error

Expected behavior

There should be no such error.

Screenshots

No response

Desktop (please complete the following information)

  • os: windows 11
  • ide: vsc insiders
  • react 19
  • @tonconnect/ui-react ^2.0.9

Smartphone (please complete the following information)

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant