Skip to content

Commit 3bd7b36

Browse files
authored
fix: subgraphs search functionality (#1540)
1 parent 18a6025 commit 3bd7b36

File tree

1 file changed

+5
-4
lines changed
  • studio/src/pages/[organizationSlug]/[namespace]/graph/[slug]

1 file changed

+5
-4
lines changed

studio/src/pages/[organizationSlug]/[namespace]/graph/[slug]/subgraphs.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ const SubGraphsPage: NextPageWithLayout = () => {
4141
if (tab === "featureSubgraphs") {
4242
const fuse = new Fuse(graphData.featureSubgraphs, {
4343
keys: ["name"],
44-
minMatchCharLength: 1,
44+
useExtendedSearch: true,
4545
});
4646

4747
const searchedFetaureSubgraphs = search
48-
? fuse.search(search).map(({ item }) => item)
48+
? fuse.search(`'${search}`).map(({ item }) => item)
4949
: graphData.featureSubgraphs;
5050

5151
setTotalCount(searchedFetaureSubgraphs.length);
@@ -55,11 +55,12 @@ const SubGraphsPage: NextPageWithLayout = () => {
5555
} else {
5656
const fuse = new Fuse(graphData.subgraphs, {
5757
keys: ["name", "id"],
58-
minMatchCharLength: 1,
58+
useExtendedSearch: true,
5959
});
6060

61+
// https://www.fusejs.io/examples.html#default-weight:~:text=%23-,Extended%20Search,-This%20form%20of
6162
const searchedSubgraphs = search
62-
? fuse.search(search).map(({ item }) => item)
63+
? fuse.search(`'${search}`).map(({ item }) => item)
6364
: graphData.subgraphs;
6465

6566
setTotalCount(searchedSubgraphs.length);

0 commit comments

Comments
 (0)