Skip to content

Commit

Permalink
Keep previous search results while querying
Browse files Browse the repository at this point in the history
Signed-off-by: Damian Stasik <[email protected]>
  • Loading branch information
damianstasik committed Sep 3, 2024
1 parent 8200cea commit 2933943
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/src/q.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { queryOptions, skipToken } from "@tanstack/react-query";
import {
keepPreviousData,
queryOptions,
skipToken,
} from "@tanstack/react-query";
import { api } from "@/query";
import { definitions } from "./api";

export const getSearchQuery = (query: string) =>
queryOptions({
queryKey: ["search", query],
placeholderData: keepPreviousData,
queryFn:
query.length > 0
? async ({ signal }) => {
Expand Down

0 comments on commit 2933943

Please sign in to comment.