From fc08f721b0de018e32fb0a778cd9b7a52b8de6c7 Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Thu, 11 Dec 2025 21:00:17 +0000 Subject: [PATCH] feat(search-spaces): add communityPromptsAtom and remove obvious comments --- .../search-spaces/search-space-query.atoms.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/surfsense_web/atoms/search-spaces/search-space-query.atoms.ts b/surfsense_web/atoms/search-spaces/search-space-query.atoms.ts index 92c2d4198..b28d19b82 100644 --- a/surfsense_web/atoms/search-spaces/search-space-query.atoms.ts +++ b/surfsense_web/atoms/search-spaces/search-space-query.atoms.ts @@ -4,20 +4,18 @@ import type { GetSearchSpacesRequest } from "@/contracts/types/search-space.type import { searchSpacesApiService } from "@/lib/apis/search-spaces-api.service"; import { cacheKeys } from "@/lib/query-client/cache-keys"; -// Atom to store current query params for search spaces export const searchSpacesQueryParamsAtom = atom({ skip: 0, limit: 10, owned_only: false, }); -// Query atom to fetch search spaces with query params export const searchSpacesAtom = atomWithQuery((get) => { const queryParams = get(searchSpacesQueryParamsAtom); return { queryKey: cacheKeys.searchSpaces.withQueryParams(queryParams), - staleTime: 5 * 60 * 1000, // 5 minutes + staleTime: 5 * 60 * 1000, queryFn: async () => { return searchSpacesApiService.getSearchSpaces({ queryParams, @@ -25,3 +23,13 @@ export const searchSpacesAtom = atomWithQuery((get) => { }, }; }); + +export const communityPromptsAtom = atomWithQuery(() => { + return { + queryKey: cacheKeys.searchSpaces.communityPrompts, + staleTime: 30 * 60 * 1000, + queryFn: async () => { + return searchSpacesApiService.getCommunityPrompts(); + }, + }; +});