Skip to content

refactor: migrate PromptConfigManager save to updateSearchSpaceMutationAtom#1431

Merged
MODSetter merged 1 commit into
MODSetter:devfrom
dekalouis:refactor/1361-prompt-config-use-mutation-atom
May 24, 2026
Merged

refactor: migrate PromptConfigManager save to updateSearchSpaceMutationAtom#1431
MODSetter merged 1 commit into
MODSetter:devfrom
dekalouis:refactor/1361-prompt-config-use-mutation-atom

Conversation

@dekalouis
Copy link
Copy Markdown
Contributor

@dekalouis dekalouis commented May 24, 2026

Migrate PromptConfigManager save handler from a raw authenticatedFetch call to the shared updateSearchSpaceMutationAtom, making all three settings managers consistent.

Description

Replaces the raw authenticatedFetch PUT call in PromptConfigManager.handleSave with updateSearchSpaceMutationAtom. Removes the local saving state (replaced by isPending from the mutation), drops the manual fetchSearchSpace() refetch (the atom's onSuccess already invalidates the cache), and removes now-unused imports (authenticatedFetch, BACKEND_URL).

Motivation and Context

general-settings-manager and team-memory-manager both route their save through updateSearchSpaceMutationAtom, which provides Zod validation, typed error handling via baseApiService, and centralized cache invalidation. PromptConfigManager was 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

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

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

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR refactors the PromptConfigManager to use the shared updateSearchSpaceMutationAtom instead of raw authenticatedFetch calls for saving prompt configurations. This change aligns the component with the existing patterns used in general-settings-manager and team-memory-manager, providing consistent error handling, Zod validation, and automatic cache invalidation across all three settings managers. The local saving state is replaced with isPending from 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
Order File Path
1 surfsense_web/components/settings/prompt-config-manager.tsx

Need help? Join our Discord

@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

@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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 24, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 87aa16d6-b2fc-459e-b401-c99b7dbe598c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MODSetter MODSetter merged commit 63e5943 into MODSetter:dev May 24, 2026
4 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants