Skip to content

Conversation

@sea-snake
Copy link
Contributor

@sea-snake sea-snake commented Nov 10, 2025

Fix switching identity in dashboard.

Changes

  • Replace gotoManage method with switchedToIdentity method.
  • Called in all methods that switched the identity (handle- switch, sign in, sign up and migration).
  • Makes sure that load function data is invalidated when identity is switched.
  • Add loading animation when identity is switched (since we're waiting for an update call).
  • Nit: key in $lastUsedIdentitiesStore.identities is a string, so using toString instead in handleSwitchIdentity.

Tests

Added e2e test to make sure page data is updated when identity is switched.

Copy link
Contributor

@lmuntaner lmuntaner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the E2E test!

Minor comment only, already approving.

const handleSignIn = async (identityNumber: bigint) => {
lastUsedIdentitiesStore.selectIdentity(identityNumber);
await gotoManage();
const switchedToIdentity = async (identityNumber: bigint) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why switched and not switch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this method is technically called after the user has already authenticated with another identity, thus switched identity.

For example it's called in handleSwitchIdentity after authentication with the next identity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But since we're calling.selectIdentity() in this method, switch might actually read better than switched.

await expect(passkey).toHaveCount(1);
});

test("User can switch between identities", async ({ page }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@sea-snake sea-snake added this pull request to the merge queue Nov 11, 2025
Merged via the queue into main with commit ee15d6c Nov 11, 2025
75 checks passed
@sea-snake sea-snake deleted the sea-snake/fix-switching-identity-in-dashboard branch November 11, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants