Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ export const useSearchRequest = (options: {
chainIds?: CaipChainId[];
query: string;
limit: number;
includeMarketData?: boolean;
}) => {
const { chainIds: providedChainIds = [], query, limit } = options;
const {
chainIds: providedChainIds = [],
query,
limit,
includeMarketData,
} = options;

// Use provided chainIds or default to trending networks
const chainIds = useMemo((): CaipChainId[] => {
Expand Down Expand Up @@ -59,6 +65,7 @@ export const useSearchRequest = (options: {
try {
const searchResults = await searchTokens(stableChainIds, query, {
limit,
includeMarketData,
});
// Only update state if this is still the current request
if (currentRequestId === requestIdRef.current) {
Expand All @@ -76,7 +83,7 @@ export const useSearchRequest = (options: {
setIsLoading(false);
}
}
}, [stableChainIds, query, limit]);
}, [stableChainIds, query, limit, includeMarketData]);

// Automatically trigger search when query changes
useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const useTrendingSearch = (
query: searchQuery || '',
limit: 20,
chainIds: chainIds ?? undefined,
includeMarketData: true,
});

const {
Expand Down
Loading