TGViewer
tmadevs tmadevs @tmdevs · 155 subscribers
Post #61 443
// Check if wallet is stored in localStorage
// it helps to handle the case when user refreshes the page
// and we don't know if wallet is connected or not
// while tonconnect is restoring wallet info
const isWalletStored = !!window?.localStorage.getItem(
'ton-connect-ui_wallet-info'
);

const wallet = useTonConnect();

console.log(wallet.connected, isWalletStored)
// false, true

// here I just example that in few seconds wallet
setTimeout(() => {
console.log(wallet.connected, isWalletStored)
// true, true
}, 10)



В react с @tonconnect есть проблема с проверкой подключен ли кошелек у пользователя или нет. Решение с isWalletStored, это то что я использую, дабы избежать разных лагов с авторизацией пользователя.

возможно у вас есть лучше способ узнать подключен ли кошелек пока tonconnect соединяется с ним, буду рад узнать 🍷
  • 👍 7
  • ❤ 3
More from @tmdevs
  1. Feb 6, 2026приветствую. а есть фронтендщики которым нужна подработка?
  2. Dec 30, 2025всех с наступающим новым годом!🎅 в новом году скидок на frontend не будет, поэтому можете…
  3. Aug 3, 2025Кому-то интересно взять в работу? Ищут фронт У нас есть ряд задач по фронтенду, к которым…
  4. Jul 7, 2025я же думаю что все это бред полнейший и надо юзать yandex cloud. собственно скоро yaswami…
  5. Jul 7, 2025Для тех, кто не знает как обойти ограничения Cloudflare для своего приложения: Cloudflare…
  6. Jul 7, 2025@Scilef поделился статьей 👀
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →