Skip to content

Commit

Permalink
Fix search page index (#896)
Browse files Browse the repository at this point in the history
  • Loading branch information
peolic authored Jan 8, 2025
1 parent a0c0b0a commit b6e069f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
1 change: 0 additions & 1 deletion frontend/src/constants/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export const ROUTE_RESET_PASSWORD = "/reset-password";
export const ROUTE_CONFIRM_EMAIL = "/users/confirm-email";
export const ROUTE_CHANGE_EMAIL = "/users/change-email";
export const ROUTE_SEARCH = "/search/*";
export const ROUTE_SEARCH_INDEX = "/search/";
export const ROUTE_VERSION = "/version";
export const ROUTE_SITE = "/sites/:id";
export const ROUTE_SITE_ADD = "/sites/add";
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
ROUTE_FORGOT_PASSWORD,
ROUTE_RESET_PASSWORD,
ROUTE_SEARCH,
ROUTE_SEARCH_INDEX,
ROUTE_VERSION,
ROUTE_SITES,
ROUTE_DRAFTS,
Expand Down Expand Up @@ -63,7 +62,6 @@ const Pages: FC = () => (
<Route path={ROUTE_FORGOT_PASSWORD} element={<ForgotPassword />} />
<Route path={ROUTE_RESET_PASSWORD} element={<ResetPassword />} />
<Route path={ROUTE_SEARCH} element={<Search />} />
<Route path={ROUTE_SEARCH_INDEX} element={<Search />} />
<Route path={ROUTE_VERSION} element={<Version />} />
<Route path={`${ROUTE_SITES}/*`} element={<Sites />} />
<Route path={`${ROUTE_DRAFTS}/*`} element={<Drafts />} />
Expand Down
11 changes: 4 additions & 7 deletions frontend/src/pages/search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
createHref,
formatDuration,
} from "src/utils";
import { ROUTE_SEARCH, ROUTE_SEARCH_INDEX } from "src/constants/route";
import { ROUTE_SEARCH } from "src/constants/route";

type Performer = NonNullable<SearchAllQuery["searchPerformer"][number]>;
type Scene = NonNullable<SearchAllQuery["searchScene"][number]>;
Expand Down Expand Up @@ -141,12 +141,9 @@ const Search: FC = () => {
() =>
debounce(
(searchTerm: string) =>
navigate(
searchTerm
? createHref(ROUTE_SEARCH, { "*": searchTerm })
: ROUTE_SEARCH_INDEX,
{ replace: true },
),
navigate(createHref(ROUTE_SEARCH, { "*": searchTerm }), {
replace: true,
}),
200,
),
[navigate],
Expand Down

0 comments on commit b6e069f

Please sign in to comment.