Skip to content

Commit

Permalink
fix: fix contextual search, closes #380
Browse files Browse the repository at this point in the history
  • Loading branch information
weareoutman committed Feb 5, 2025
1 parent f64b972 commit 2a6d9d4
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,14 @@ export default function SearchBar({

const prevSearchContext = useRef<string>("");
const [searchContext, setSearchContext] = useState<string>("");
const prevVersionUrl = useRef<string>(baseUrl);
useEffect(() => {
if (!Array.isArray(searchContextByPaths)) {
if (prevVersionUrl.current !== versionUrl) {
// Reset index state map once version url is changed.
indexStateMap.current.delete("");
prevVersionUrl.current = versionUrl;
}
return;
}
let nextSearchContext = "";
Expand Down

0 comments on commit 2a6d9d4

Please sign in to comment.