Skip to content

Commit

Permalink
Lowercase in hook
Browse files Browse the repository at this point in the history
  • Loading branch information
mcayuelas-ledger committed Jul 19, 2024
1 parent 9485dcb commit 9bbb0e2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function SearchInputComponent({ search, updateSearch }: Props) {
}, [debouncedSearch, updateSearch]);

useEffect(() => {
setInputSearch(search.toLowerCase());
setInputSearch(search);
}, [search]);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function SearchHeader({ search, refresh }: Props) {
}, [debouncedSearch, refresh]);

useEffect(() => {
setInputSearch(search?.toLowerCase());
setInputSearch(search);
}, [search]);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const useSupportedCurrencies = () =>
});

export function useMarketData(props: MarketListRequestParams): MarketListRequestResult {
const search = props.search?.toLowerCase() ?? "";
return useQueries({
queries: Array.from({ length: props.page ?? 1 }, (_, i) => i).map(page => ({
queryKey: [
Expand All @@ -93,15 +94,15 @@ export function useMarketData(props: MarketListRequestParams): MarketListRequest
props.order,
{
counterCurrency: props.counterCurrency,
...(props.search && props.search?.length >= 2 && { search: props.search }),
...(props.search && props.search?.length >= 2 && { search: search }),
...(props.starred && props.starred?.length >= 1 && { starred: props.starred }),
...(props.liveCoinsList &&
props.liveCoinsList?.length >= 1 && { liveCoinsList: props.liveCoinsList }),
...(props.order &&
[Order.topLosers, Order.topGainers].includes(props.order) && { range: props.range }),
},
],
queryFn: () => fetchList({ ...props, page }),
queryFn: () => fetchList({ ...props, page, search }),
select: (data: MarketItemResponse[]) => ({
formattedData: currencyFormatter(data, cryptoCurrenciesList),
page,
Expand Down

0 comments on commit 9bbb0e2

Please sign in to comment.