Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When configured for a single collection, UserTokensGrid.tsx shows all NFTs for a split second #573

Open
Andriy1221 opened this issue Nov 2, 2022 · 0 comments · May be fixed by #574
Open

Comments

@Andriy1221
Copy link

Description:
I noticed that when the marketplace is configured to show only one collection and you open a wallet page (pages/address/[address].tsx) to see which NFTs the person owns, the UserTokensGrid.tsx component first shows all NFTs and then filters to show only the NFTs from the configured collection. This happens quickly but the first unfiltered result is visible for a split second which I think should be avoided.

Suggestion:
As far as I understand, the UseUserTokens hook from reservoir0x/reservoir-kit-ui returns an object that is saved as userTokens in UserTokensGrid.tsx with the method mutate(). Initially userTokens includes all tokens, and then in an useEffect hook mutate() is called to filter the results, which creates a new userTokens object that only includes NFTs from the configured collection.

I suggest to use a state to check whether the mutate function was already called and only show the results after that. Maybe there is a cleaner solution though. I will open a PR to address this issue.

For reference

screen-recording.mov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant