Closed jrhe closed 1 month ago
would appreciate the reproduction, however this is likely because we do not refresh the query state in useSiweAuth
on manual logout api call - open to suggestions on how to fix it
Reproduction here: https://github.com/jrhe/thirdweb-createembed-state-bug
The best way I can think of is to extract out the useSiweAuth
state so that logout can be called on it directly by other components that need it. I think this is how I'd probably do it if I wasn't using ConnectEmbed
but writing my own interface.
Alternatively, there might be a way to stop the state of isLoggedIn
being cached.
I have same problem.
Hey @jrhe, my apologies this appears to have slipped. I'm working on a fix for this now.
Hey @jrhe @ninpeng, this should be fixed in v5.63.1
If you create a
ConnectEmbed
and connect a wallet, the SIWE functions passed to theauth
key are called correctly, with the user being logged into the server.If you then sign out on the server, by calling your
logout
endpoint (thelogout
action in the example repos), and disconnect the wallet, theConnectEmbed
allows you to connect again. When you connect again the SIWE functions passed toauth
are not called, as theConnectEmbed
has stale state and thinks that it is already connected to the server.I have had a look at the implementation of
ConnectEmbed
and can't quite figure out how to fix it as I'm not familiar enough with tanstack query. One way would be to change the API such that the user has to calluseSiweAuth
and pass the return value into theConnectEmbed
. The user could then call thedoLogout
function on the siwe instance.