@@ -14,24 +14,25 @@ import type {
1414} from "@pythnetwork/component-library/Table" ;
1515import { Table } from "@pythnetwork/component-library/Table" ;
1616import { useLogger } from "@pythnetwork/component-library/useLogger" ;
17- import { useQueryState , parseAsString } from "nuqs" ;
17+ import { matchSorter } from "match-sorter" ;
18+ import { parseAsString , useQueryState } from "nuqs" ;
1819import type { ReactNode } from "react" ;
1920import { Suspense , useCallback , useMemo } from "react" ;
20- import { useFilter , useCollator } from "react-aria" ;
21+ import { useCollator } from "react-aria" ;
2122
22- import styles from "./price-feeds-card.module.scss" ;
2323import { useQueryParamFilterPagination } from "../../hooks/use-query-param-filter-pagination" ;
2424import { Cluster } from "../../services/pyth" ;
2525import { AssetClassBadge } from "../AssetClassBadge" ;
2626import { FeedKey } from "../FeedKey" ;
2727import {
28- SKELETON_WIDTH ,
29- LivePrice ,
3028 LiveConfidence ,
29+ LivePrice ,
3130 LiveValue ,
31+ SKELETON_WIDTH ,
3232} from "../LivePrices" ;
3333import { PriceFeedTag } from "../PriceFeedTag" ;
3434import { PriceName } from "../PriceName" ;
35+ import styles from "./price-feeds-card.module.scss" ;
3536
3637type Props = {
3738 id : string ;
@@ -56,7 +57,6 @@ export const PriceFeedsCard = ({ priceFeeds, ...props }: Props) => (
5657const ResolvedPriceFeedsCard = ( { priceFeeds, ...props } : Props ) => {
5758 const logger = useLogger ( ) ;
5859 const collator = useCollator ( ) ;
59- const filter = useFilter ( { sensitivity : "base" , usage : "search" } ) ;
6060 const [ assetClass , setAssetClass ] = useQueryState (
6161 "assetClass" ,
6262 parseAsString . withDefault ( "" ) ,
@@ -83,14 +83,19 @@ const ResolvedPriceFeedsCard = ({ priceFeeds, ...props }: Props) => {
8383 mkPageLink,
8484 } = useQueryParamFilterPagination (
8585 feedsFilteredByAssetClass ,
86- ( priceFeed , search ) => filter . contains ( priceFeed . displaySymbol , search ) ,
86+ ( ) => true ,
8787 ( a , b , { column, direction } ) => {
8888 const field = column === "assetClass" ? "assetClass" : "displaySymbol" ;
8989 return (
9090 ( direction === "descending" ? - 1 : 1 ) *
9191 collator . compare ( a [ field ] , b [ field ] )
9292 ) ;
9393 } ,
94+ ( items , search ) => {
95+ return matchSorter ( items , search , {
96+ keys : [ "displaySymbol" , "symbol" , "description" , "key" ] ,
97+ } ) ;
98+ } ,
9499 { defaultSort : "priceFeedName" } ,
95100 ) ;
96101
0 commit comments