Skip to content

Commit 91f3e70

Browse files
committed
Fixed search item icons
1 parent e384c87 commit 91f3e70

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/components/SearchPalette.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { useVirtual } from "react-virtual";
2424
import { truncate } from "lodash-es";
2525
import { JSONHeroPath } from "@jsonhero/path";
2626
import { useHotkeys } from "react-hotkeys-hook";
27+
import { useJson } from "~/hooks/useJson";
2728

2829
export function SearchPalette({
2930
onSelect,
@@ -217,9 +218,11 @@ export function SearchItem({
217218
result,
218219
isHighlighted,
219220
}: SearchItemProps) {
220-
const ItemIcon = iconForValue(result.item.rawValue);
221-
222221
const heroPath = new JSONHeroPath(result.item.path);
222+
const [json] = useJson();
223+
224+
const itemValue = heroPath.first(json);
225+
const ItemIcon = iconForValue(itemValue);
223226

224227
const components = heroPath.components.slice(1);
225228

0 commit comments

Comments
 (0)