Commit a5dc0fdd authored by vignesh mohankumar's avatar vignesh mohankumar Committed by GitHub

fix: remove ignore exhaustive deps in SearchBarDropdown (#4746)

* fix: remove ignore exhaustive deps in SearchBarDropdown

* move into the effect
parent 134f30e8
...@@ -94,38 +94,6 @@ export const SearchBarDropdown = ({ toggleOpen, tokens, collections, hasInput, i ...@@ -94,38 +94,6 @@ export const SearchBarDropdown = ({ toggleOpen, tokens, collections, hasInput, i
const phase1Flag = useNftFlag() const phase1Flag = useNftFlag()
const [resultsState, setResultsState] = useState<ReactNode>() const [resultsState, setResultsState] = useState<ReactNode>()
const tokenSearchResults =
tokens.length > 0 ? (
<SearchBarDropdownSection
hoveredIndex={hoveredIndex}
startingIndex={isNFTPage ? collections.length : 0}
setHoveredIndex={setHoveredIndex}
toggleOpen={toggleOpen}
suggestions={tokens}
header={<Trans>Tokens</Trans>}
/>
) : (
<Box className={styles.notFoundContainer}>
<Trans>No tokens found.</Trans>
</Box>
)
const collectionSearchResults =
phase1Flag === NftVariant.Enabled ? (
collections.length > 0 ? (
<SearchBarDropdownSection
hoveredIndex={hoveredIndex}
startingIndex={isNFTPage ? 0 : tokens.length}
setHoveredIndex={setHoveredIndex}
toggleOpen={toggleOpen}
suggestions={collections}
header={<Trans>NFT Collections</Trans>}
/>
) : (
<Box className={styles.notFoundContainer}>No NFT collections found.</Box>
)
) : null
const { data: trendingCollectionResults, isLoading: trendingCollectionsAreLoading } = useQuery( const { data: trendingCollectionResults, isLoading: trendingCollectionsAreLoading } = useQuery(
['trendingCollections', 'eth', 'twenty_four_hours'], ['trendingCollections', 'eth', 'twenty_four_hours'],
() => fetchTrendingCollections({ volumeType: 'eth', timePeriod: 'ONE_DAY' as TimePeriod, size: 3 }) () => fetchTrendingCollections({ volumeType: 'eth', timePeriod: 'ONE_DAY' as TimePeriod, size: 3 })
...@@ -204,6 +172,38 @@ export const SearchBarDropdown = ({ toggleOpen, tokens, collections, hasInput, i ...@@ -204,6 +172,38 @@ export const SearchBarDropdown = ({ toggleOpen, tokens, collections, hasInput, i
useEffect(() => { useEffect(() => {
if (!isLoading) { if (!isLoading) {
const tokenSearchResults =
tokens.length > 0 ? (
<SearchBarDropdownSection
hoveredIndex={hoveredIndex}
startingIndex={isNFTPage ? collections.length : 0}
setHoveredIndex={setHoveredIndex}
toggleOpen={toggleOpen}
suggestions={tokens}
header={<Trans>Tokens</Trans>}
/>
) : (
<Box className={styles.notFoundContainer}>
<Trans>No tokens found.</Trans>
</Box>
)
const collectionSearchResults =
phase1Flag === NftVariant.Enabled ? (
collections.length > 0 ? (
<SearchBarDropdownSection
hoveredIndex={hoveredIndex}
startingIndex={isNFTPage ? 0 : tokens.length}
setHoveredIndex={setHoveredIndex}
toggleOpen={toggleOpen}
suggestions={collections}
header={<Trans>NFT Collections</Trans>}
/>
) : (
<Box className={styles.notFoundContainer}>No NFT collections found.</Box>
)
) : null
const currentState = () => const currentState = () =>
hasInput ? ( hasInput ? (
// Empty or Up to 8 combined tokens and nfts // Empty or Up to 8 combined tokens and nfts
...@@ -263,7 +263,6 @@ export const SearchBarDropdown = ({ toggleOpen, tokens, collections, hasInput, i ...@@ -263,7 +263,6 @@ export const SearchBarDropdown = ({ toggleOpen, tokens, collections, hasInput, i
setResultsState(currentState) setResultsState(currentState)
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ }, [
isLoading, isLoading,
tokens, tokens,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment