xmtp / example-chat-react

This repo has been archived. Replacement apps include the XMTP Quickstart React and XMTP Inbox chat apps. For more details and links, see the README in this repo.
MIT License
74 stars 52 forks source link

Bug: AddressInput is sending multiple invites #168

Closed nakajima closed 1 year ago

nakajima commented 1 year ago

When initiating from the React app to the iOS example app, I noticed three different invites coming in, with three different topics for the same peer address. Looking at the network tab, it seemed to confirm this. I added this following console.log:

image

Then pasted an address into the address input and got the following in the console output:

Screen Shot 2022-12-21 at 4 33 51 PM

I was also able to verify this using a test script that I ran once to publish the user contact and verify there were no conversations, then again after I pasted the script's wallet address into the address input on the website.

import Client from './Client'
import { PrivateKey } from './crypto'
import { Wallet } from 'ethers'

const keyBytes = [
  53, 222, 207, 146, 166, 40, 92, 218, 85, 194, 222, 186, 136, 216, 78, 73, 40,
  85, 195, 225, 86, 141, 136, 37, 221, 38, 120, 159, 231, 95, 14, 244,
]

const wallet = new Wallet(keyBytes)
console.log(`OUR WALLET ADDRESS IS ${wallet.address}`)

async function checkAll() {
  const client = await Client.create(wallet, { env: 'dev' })
  await client.publishUserContact()
  const conversations = await client.conversations.list()
  console.log('conversations', conversations)
}

checkAll().then(() => console.log('Done'))

When I ran it a second time I was able to verify that there were three conversations created.

View script output image

Expected behavior

I think I'd only expect to see 1 invite sent. There's probably some work to be done on the other end in the iOS SDK to handle multiple invites from the same sender with the same conversationId, so I'll open an issue over there as well.

neekolas commented 1 year ago

Oof. That's a good catch. Will fix