Skip to content

Commit eaa3675

Browse files
committed
feat: simplify the isExactHit logic to highlightText comparison
1 parent 9c2e258 commit eaa3675

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/components/DatasetDetailPage/FileTree/FileTreeRow.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,10 @@ const FileTreeRow: React.FC<Props> = ({
123123
const externalUrl = node.link?.url;
124124

125125
const rowRef = React.useRef<HTMLDivElement | null>(null);
126-
// Highlight only if this row is exactly the subject folder (e.g., "sub-04")
127-
// const isSubjectFolder =
128-
// node.kind === "folder" && /^sub-[A-Za-z0-9]+$/i.test(node.name);
126+
// Highlight only if this row is exactly the same as the focus highlightText
129127
const isExactHit =
130-
!!highlightText &&
131-
node.name.trim().toLowerCase() === highlightText.trim().toLowerCase();
128+
node.name.trim().toLowerCase() ===
129+
(highlightText ?? "").trim().toLowerCase();
132130

133131
React.useEffect(() => {
134132
if (isExactHit && rowRef.current) {

0 commit comments

Comments
 (0)