fix(site): include archived filter in q param for agents list (#22973)

This commit is contained in:
Danielle Maywood
2026-03-11 23:00:20 +00:00
committed by GitHub
parent 45c32d62c5
commit a342fc43c3
2 changed files with 11 additions and 3 deletions
-1
View File
@@ -2942,7 +2942,6 @@ class ApiMethods {
limit?: number;
offset?: number;
q?: string;
archived?: boolean;
}): Promise<TypesGen.Chat[]> => {
const response = await this.axios.get<TypesGen.Chat[]>(
getURLWithSearchParams("/api/experimental/chats", req),
+11 -2
View File
@@ -52,6 +52,16 @@ const DEFAULT_CHAT_PAGE_LIMIT = 50;
export const infiniteChats = (opts?: { q?: string; archived?: boolean }) => {
const limit = DEFAULT_CHAT_PAGE_LIMIT;
// Build the search query string including the archived filter.
const qParts: string[] = [];
if (opts?.q) {
qParts.push(opts.q);
}
if (opts?.archived !== undefined) {
qParts.push(`archived:${opts.archived}`);
}
const q = qParts.length > 0 ? qParts.join(" ") : undefined;
return {
queryKey: [...chatsKey, opts],
getNextPageParam: (lastPage: TypesGen.Chat[], pages: TypesGen.Chat[][]) => {
@@ -68,8 +78,7 @@ export const infiniteChats = (opts?: { q?: string; archived?: boolean }) => {
return API.getChats({
limit,
offset: pageParam <= 0 ? 0 : (pageParam - 1) * limit,
q: opts?.q,
archived: opts?.archived,
q,
});
},
refetchOnWindowFocus: true as const,