Merge pull request #529 from kespinola/fix/load-metadata-dups

Remove duplicate metadata from state
This commit is contained in:
Adam Jeffries 2021-09-27 23:49:59 -05:00 committed by GitHub
commit c519beb458
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

1
js/.tool-versions Normal file
View File

@ -0,0 +1 @@
nodejs 14.17.1

View File

@ -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<Metadata>, b: ParsedAccount<Metadata>) =>
a.pubkey === b.pubkey,
);
return state;
};

View File

@ -1,3 +1,6 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.