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

Session reset and tokenId set not consistent #32

Open
ryancrunchi opened this issue Mar 22, 2024 · 0 comments
Open

Session reset and tokenId set not consistent #32

ryancrunchi opened this issue Mar 22, 2024 · 0 comments

Comments

@ryancrunchi
Copy link

ryancrunchi commented Mar 22, 2024

Hello,

Here are some tests related to issues I faced mostly with session reset, session loading and token id setting. The result seem not logical to me but maybe I use the sdk wrong. The sdk functions called (or onLoaded callback) are given at each steps:

Step 1: anonymous user not connected

Crisp.configure(xxx, { locale: 'fr', autoload: false })
Crisp.load()
=> Crisp.session.onLoaded(session_1)
  • result: new empty chatbox ✅

Step 2: login as userA

Crisp.setTokenId(userA)
  • result: messages from anonymous session_1 still visible ❌
  • expected: new empty chatbox for userA (sessionMerge false by default)

Step 3: logout, now anonymous again

Crisp.session.reset()
=> Crisp.session.onLoaded(session_2)
  • result: chatbox has messages from session_2 (maybe a previous session I had locally ??)
    completely other messages, not related to first anonymous session with Step 1 (session_1) ❌
  • expected: messages from anonymous session_1 or new empty chatbox

Step 4: page reload, still anonymous

Crisp.configure(xxx, { locale: 'fr', autoload: false })
Crisp.load()
=> Crisp.session.onLoaded(session_2)
  • result: chatbox has messages from session_2

  • expected: messages from anonymous session_1 or new empty chatbox

Step 5: login as userB

Crisp.setTokenId(userB)
  • result : no changes in chatbox, still messages from session_2
  • expected: new empty chatbox for userB

Step 6: page reload as userB

Crisp.configure(xxx, { locale: 'fr', autoload: false })
Crisp.setTokenId(userB)
Crisp.load()
=> Crisp.session.onLoaded(session_3)
  • result: messages from userB visible ✅

Step 7: logout, now anonymous again

Crisp.session.reset()
=> Crisp.session.onLoaded(session_3)
  • result: messages from userB still visible (session_3) ❌
  • expected: messages from anonymous session_1 or new empty chatbox

Step 8: page reload as anonymous

Crisp.configure(xxx, { locale: 'fr', autoload: false })
Crisp.load()
=> Crisp.session.onLoaded(session_3)
  • result: messages from userB still visible (session_3) ❌
  • expected: messages from anonymous session_1 or new empty chatbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant