refactor: migrate PromptConfigManager save to updateSearchSpaceMutationAtom#1431
Conversation
|
@dekalouis is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Migrate
PromptConfigManagersave handler from a rawauthenticatedFetchcall to the sharedupdateSearchSpaceMutationAtom, making all three settings managers consistent.Description
Replaces the raw
authenticatedFetchPUT call inPromptConfigManager.handleSavewithupdateSearchSpaceMutationAtom. Removes the localsavingstate (replaced byisPendingfrom the mutation), drops the manualfetchSearchSpace()refetch (the atom'sonSuccessalready invalidates the cache), and removes now-unused imports (authenticatedFetch,BACKEND_URL).Motivation and Context
general-settings-managerandteam-memory-managerboth route their save throughupdateSearchSpaceMutationAtom, which provides Zod validation, typed error handling viabaseApiService, and centralized cache invalidation.PromptConfigManagerwas bypassing all of that with a raw fetch, causing inconsistent error handling and cache behavior across the three managers.FIX #1361
Screenshots
N/A — pure refactor, no visual change.
API Changes
Change Type
Testing Performed
Open Settings → Prompt Config, edit the instructions and click Save — success toast appears and the textarea reflects the saved value. TypeScript reports zero errors on the changed file (
npx tsc --noEmit --skipLibCheck).Checklist
High-level PR Summary
This PR refactors the
PromptConfigManagerto use the sharedupdateSearchSpaceMutationAtominstead of rawauthenticatedFetchcalls for saving prompt configurations. This change aligns the component with the existing patterns used ingeneral-settings-managerandteam-memory-manager, providing consistent error handling, Zod validation, and automatic cache invalidation across all three settings managers. The localsavingstate is replaced withisPendingfrom the mutation hook, and manual cache refetching is removed since the mutation atom handles cache invalidation automatically.⏱️ Estimated Review Time: 5-15 minutes
💡 Review Order Suggestion
surfsense_web/components/settings/prompt-config-manager.tsx