From fc94a8a2aff39f9594f593ed165cabe92c86dd81 Mon Sep 17 00:00:00 2001 From: Kyle Espinola Date: Mon, 27 Sep 2021 17:23:55 -0700 Subject: [PATCH] fix: remove duplicate metdata caused by searching all whitelisted creators for the store --- js/.tool-versions | 1 + js/packages/common/src/contexts/meta/loadAccounts.ts | 7 ++++++- js/packages/web/next-env.d.ts | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 js/.tool-versions diff --git a/js/.tool-versions b/js/.tool-versions new file mode 100644 index 0000000..734e8b0 --- /dev/null +++ b/js/.tool-versions @@ -0,0 +1 @@ +nodejs 14.17.1 diff --git a/js/packages/common/src/contexts/meta/loadAccounts.ts b/js/packages/common/src/contexts/meta/loadAccounts.ts index 408ab4c..3d29f01 100644 --- a/js/packages/common/src/contexts/meta/loadAccounts.ts +++ b/js/packages/common/src/contexts/meta/loadAccounts.ts @@ -19,6 +19,7 @@ import { decodeMetadata, getAuctionExtended, } from '../../actions'; +import { uniqWith } from 'lodash'; import { WhitelistedCreator } from '../../models/metaplex'; import { Connection, PublicKey } from '@solana/web3.js'; import { @@ -304,7 +305,11 @@ export const loadAccounts = async (connection: Connection) => { await Promise.all(loading); - console.log('Metadata size', state.metadata.length); + state.metadata = uniqWith( + state.metadata, + (a: ParsedAccount, b: ParsedAccount) => + a.pubkey === b.pubkey, + ); return state; }; diff --git a/js/packages/web/next-env.d.ts b/js/packages/web/next-env.d.ts index c6643fd..9bc3dd4 100644 --- a/js/packages/web/next-env.d.ts +++ b/js/packages/web/next-env.d.ts @@ -1,3 +1,6 @@ /// /// /// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information.