fix: always remove guestIdentityId from keyValueStorage on client-side
Description of changes
Using SSR the guest token in the cookies does not get removed on login. This is because storeIdentityId is called on the server-side before it is called on the client-side, thereby setting _hasGuestIdentityId to false and hindering the client-side to remove the cookie in the browser.
We do not always want to remove the guest identity cookie, because we want to prevent unnecessary cookie deletions when switching between identity types or during credential refreshes. (synced about this with @HuiSF - see https://github.com/aws-amplify/amplify-js/issues/13787)
We fix this by
Issue
https://github.com/aws-amplify/amplify-js/issues/14378
Description of how you validated changes
- Ran next.js app provided by costumer
- Ran react app to validate that it does not break none SSR flows
- e2e tests see: https://github.com/aws-amplify/amplify-js/actions/runs/15782549397
Checklist
- [x] PR description included
- [x]
yarn testpasses - [x] Unit Tests are changed
Checklist for repo maintainers
- [x] Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.