Open niklasp opened 4 months ago
Latest commit: 5385fc0c9033e959a90b184ca46021f15dd3d48d
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@wottpal comments?
@wottpal Could you please take a look and give feedback on this PR, I currently use use-inkathon on my daap and I thing this feature is a must. thank you
I will revisit this one shortly, sorry for the radio silence :)
@wottpal atm i have to use my cloned version for dapps as this is missing. any chance for merge? I can also change things.
pong
This PR closes #15 by storing the selected extension + walletAddress in localstorage when the extension is enabled / the account is selected. The selections are then restored when the dApp is initialized. For backwards compatibility the
setActiveAccount
function is overridden to atomatically save to local storage.The other addition is the
userWantsConnection
const also discussed in #15 which enables a better UX by not popping up extension windows on page visit. For backwards compatibility whenconnectOnInit
is set totrue
in the provider, the popups remain. When it is set tofalse
and the user already connected an extension + account, it will also connect the wallet on page reload - until the user disconnects.See also this video with a demo of a first visitor to the dapp
https://github.com/scio-labs/use-inkathon/assets/1685139/038eb1d5-48a6-406c-8d73-de50500bb5eb
and check it out live on a boilerplate including the changes here (with
connectOnInit={false}
behavior): https://inkathon-frontend-git-localstorage-niklasps-projects.vercel.app/