Skip to content

fix: pass userId to Segment identify and handle wallet account changes#295

Open
braianj wants to merge 2 commits intomainfrom
feat/hook-update
Open

fix: pass userId to Segment identify and handle wallet account changes#295
braianj wants to merge 2 commits intomainfrom
feat/hook-update

Conversation

@braianj
Copy link
Copy Markdown
Contributor

@braianj braianj commented Feb 25, 2026

  • Fix analytics.identify() calls that passed ethAddress only as a trait
    instead of as the userId (first argument), causing Segment to reuse the
    cached userId when switching wallets
  • Use identifyUser utility in RequestPage instead of calling
    getAnalytics()?.identify() directly
  • Add accountsChanged listener to useCurrentConnectionData so pages
    react when the user switches wallet in their provider (e.g. MetaMask)
  • Remove duplicate hooks.ts file and consolidate imports to hook.ts

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
auth Ready Ready Preview, Comment Feb 25, 2026 9:30pm

Request Review

@braianj braianj self-assigned this Feb 25, 2026
@braianj braianj added the bug Something isn't working label Feb 25, 2026
const [isLoading, setIsLoading] = useState(true)

const refreshConnectionData = useCallback(async () => {
const data = await getCurrentConnectionData()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we need a context and a provider for the wallet connection. If not, this hook will be called on each page load, trying to perform a connection with the connector and getting the credentials each time it can.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We might want to extract the module from https://github.com/decentraland/internal-tools/tree/main/src/modules/wallet and use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants