Skip to content

Commit

Permalink
Fix duplicating key error for dApps with the same name
Browse files Browse the repository at this point in the history
  • Loading branch information
asiia-trilitech committed Mar 11, 2024
1 parent 23343ce commit b58cf4a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions src/utils/beacon/BeaconPeers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,31 @@ describe("<BeaconPeers />", () => {
}
});

it("resolves duplicating name for diffferent dAppIds", async () => {
jest.spyOn(beaconHelper, "usePeers").mockReturnValue({
data: [
{
name: "dApp",
publicKey: "e15835f5b7bb7fae5a3ddbe3c71b3cdd9ee0a5ea2586f04e7669e9040f61810c",
senderId: "2MqUhvyAJy3UY",
type: "p2p-pairing-request",
id: "test-id-1",
version: "v1",
},
{
name: "dApp",
publicKey: "e15835f5b7bb7fae5a3ddbe3c71b3cdd9ee0a5ea2586f04e7669e9040f61810b",
senderId: "2UJwaEUy23W3g",
type: "p2p-pairing-request",
id: "test-id-2",
version: "v1.5",
},
],
} as any);

await getPeerRows(2);
});

describe("for saved connections", () => {
it("displays address pill with acc label if connected acc is present", async () => {
store.dispatch(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/beacon/BeaconPeers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const BeaconPeers = () => {
return (
<Box>
{peersWithId.map(peerInfo => (
<PeersDisplay key={peerInfo.name} peerInfo={peerInfo} />
<PeersDisplay key={peerInfo.senderId} peerInfo={peerInfo} />
))}
</Box>
);
Expand Down

0 comments on commit b58cf4a

Please sign in to comment.