I think so too, it being configurable would be a good way to go.
Interesting that the iOS SDK works differently. This was also not the case in previous versions of the Javascript SDK:
- SDK v1.11.0: in no scenario a user was deleted.
- SDK 2.19.0 and master branch: in 2 scenarios, on
logout
andsetCurrentUser
async setCurrentUser(user) {
const currentUser = await this.currentUserAsync();
if (currentUser && !user.equals(currentUser) && AnonymousUtils.isLinked(currentUser)) {
await currentUser.destroy({ sessionToken: currentUser.getSessionToken() })
}
...
}