From 3c514756c767411dc8093c96c9f90b36dfe09eef Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Mon, 15 Dec 2025 10:42:35 +0000 Subject: [PATCH] refactor: use destructuring pattern for community prompts atom --- surfsense_web/components/onboard/setup-prompt-step.tsx | 4 +--- surfsense_web/components/settings/prompt-config-manager.tsx | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/surfsense_web/components/onboard/setup-prompt-step.tsx b/surfsense_web/components/onboard/setup-prompt-step.tsx index 3327b5489..5e3683031 100644 --- a/surfsense_web/components/onboard/setup-prompt-step.tsx +++ b/surfsense_web/components/onboard/setup-prompt-step.tsx @@ -22,9 +22,7 @@ interface SetupPromptStepProps { } export function SetupPromptStep({ searchSpaceId, onComplete }: SetupPromptStepProps) { - const communityPromptsQuery = useAtomValue(communityPromptsAtom); - const prompts = communityPromptsQuery.data || []; - const loadingPrompts = communityPromptsQuery.isPending; + const { data: prompts = [], isPending: loadingPrompts } = useAtomValue(communityPromptsAtom); const [enableCitations, setEnableCitations] = useState(true); const [customInstructions, setCustomInstructions] = useState(""); const [saving, setSaving] = useState(false); diff --git a/surfsense_web/components/settings/prompt-config-manager.tsx b/surfsense_web/components/settings/prompt-config-manager.tsx index 082f438b0..dae842305 100644 --- a/surfsense_web/components/settings/prompt-config-manager.tsx +++ b/surfsense_web/components/settings/prompt-config-manager.tsx @@ -40,9 +40,7 @@ export function PromptConfigManager({ searchSpaceId }: PromptConfigManagerProps) queryFn: () => searchSpacesApiService.getSearchSpace({ id: searchSpaceId }), enabled: !!searchSpaceId, }); - const communityPromptsQuery = useAtomValue(communityPromptsAtom); - const prompts = communityPromptsQuery.data || []; - const loadingPrompts = communityPromptsQuery.isPending; + const { data: prompts = [], isPending: loadingPrompts } = useAtomValue(communityPromptsAtom); const [enableCitations, setEnableCitations] = useState(true); const [customInstructions, setCustomInstructions] = useState("");