Skip to content

Commit

Permalink
fix the transient messages, so they stick until a new search is run
Browse files Browse the repository at this point in the history
  • Loading branch information
marcpems committed Oct 7, 2024
1 parent 5a7a702 commit 901692b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/components/Search/PageFind.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,18 @@ const PageFind = ({
compatibility: url.searchParams.get("compatibility")?.split(","),
auto_super_resolution: url.searchParams.get("auto_super_resolution")?.split(","),
page: url.searchParams.get("page"),
searchrun: false,
};
});

const [page, setPage] = createSignal(
pathParams().page ? Number(pathParams().page) : 1
);

const [searchrun, setSearchRun] = createSignal(
pathParams().searchrun ? pathParams().searchrun: Boolean(false)
);

const [search, setSearch] = createSignal<{
query: string | null;
filters: Filters;
Expand Down Expand Up @@ -233,6 +238,7 @@ const PageFind = ({
window.history.replaceState({}, "", url.toString());
setRequest(search());
setPage(1);
setSearchRun(Boolean(true));
};

const [results] = createResource<Results, SearchQuery>(request, fetchResults);
Expand Down Expand Up @@ -304,6 +310,7 @@ const PageFind = ({
clearSearch={clearSearch}
setFilter={setFilter}
type={type}
searchRun={searchrun}
/>
</Show>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/components/Search/Results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ const Results = ({
clearSearch,
setFilter,
type,
searchRun,
}: {
page: Accessor<number>;
setPage: Setter<number>;
Expand All @@ -188,6 +189,7 @@ const Results = ({
clearSearch: () => void;
setFilter: (filter: string, selection: string, value: boolean) => void;
type: "applications" | "games";
searchRun: Accessor<boolean>
}) => {
const [paginatedResults, setPaginatedResults] = createSignal([]);

Expand Down Expand Up @@ -269,8 +271,7 @@ const Results = ({

<Match when={
results().results.length === 0 &&
(search().query !== null &&
search().filters !== null)
searchRun() === Boolean(true)
}>
<div class="w-full flex flex-col items-center gap-3 p-10">
<p class="text-center text-xl mb-2">
Expand Down

0 comments on commit 901692b

Please sign in to comment.