Skip to content

Commit

Permalink
fix: resolve incorrect redirect to 404 page on search fields (#3959)
Browse files Browse the repository at this point in the history
Co-authored-by: Brandon Roberts <[email protected]>
  • Loading branch information
Mandeep56Singh and brandonroberts authored Aug 22, 2024
1 parent 3291c6d commit 298161d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/organisms/Repositories/repositories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentProps, useEffect, useState } from "react";
import { useRouter } from "next/router";
import clsx from "clsx";
import { useRouter } from "next/router";
import { ComponentProps, useEffect, useState } from "react";

import { usePostHog } from "posthog-js/react";
import TableTitle from "components/atoms/TableTitle/table-title";
Expand All @@ -13,8 +13,8 @@ import useSupabaseAuth from "lib/hooks/useSupabaseAuth";
import { setQueryParams } from "lib/utils/query-params";

import Checkbox from "components/atoms/Checkbox/checkbox";
import Button from "components/shared/Button/button";
import LimitSelect from "components/atoms/Select/limit-select";
import Button from "components/shared/Button/button";
import { useMediaQuery } from "lib/hooks/useMediaQuery";
import RepositoriesTable, { classNames, RepositoriesRows } from "../RepositoriesTable/repositories-table";
import RepoNotIndexed from "./repository-not-indexed";
Expand Down Expand Up @@ -95,10 +95,10 @@ export default function Repositories({ repositories, showSearch = true, personal

const handleOnSearch = (search?: string) => {
if (selectedFilter && !search) {
return router.push(`/${topic}/${toolName}`);
return router.push(`/explore/topic/${topic}/${toolName}`);
}
if (search && /^[a-zA-Z0-9\-\.]+\/[a-zA-Z0-9\-\.]+$/.test(search)) {
return router.push(`/${topic}/${toolName}/filter/${search}`);
return router.push(`/explore/topic/${topic}/${toolName}/filter/${search}`);
}
};

Expand Down

0 comments on commit 298161d

Please sign in to comment.