Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve incorrect redirect to 404 page on search fields #3959

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading