react-appwrite icon indicating copy to clipboard operation
react-appwrite copied to clipboard

Session changes on other devices replaces state on local device

Open Megamannen opened this issue 2 years ago • 2 comments

If I am logged in on device A and device B.

  1. Device B logs out
  2. Device A gets the logout event and replaces whole state with the ended session from Device B

(It of course also triggers on more cases, like when you are on logged in on Device A and a device B logs in)

https://github.com/react-appwrite/react-appwrite/blob/8f6b7284bc3152d98b9b2320792d88fba79542ec/src/account/useAccount.ts#L45

Edit: Just realized also that you probaby expect a UserObject in that set, but session changes payload is a SessionObject. So it's the wrong kind of data

Megamannen avatar Sep 05 '23 11:09 Megamannen

It also breaks useTeams since it is dependent on useAccount

Megamannen avatar Sep 05 '23 11:09 Megamannen

Ah, yeah I see what you mean. Good catch. I'm looking into this.

sanny-io avatar Sep 07 '23 07:09 sanny-io