mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-19 18:45:15 +02:00
fix(web): suppress global error toast on mutations that own their toast UX
Closes #1371. Retarget of #1385 onto dev per maintainer request. surfsense_web/lib/query-client/client.ts configures a global MutationCache.onError that shows an error toast for every failed mutation unless meta.suppressGlobalErrorToast is set. The opt-out hook existed in the consumer but had zero producers — every mutation atom that already had its own onError: toast.error(...) was double-toasting on failure. Add meta: { suppressGlobalErrorToast: true } to the 30 mutations across 9 atom files that own their own error toast: - atoms/prompts/prompts-mutation.atoms.ts (4) - atoms/invites/invites-mutation.atoms.ts (4) - atoms/chat-comments/comments-mutation.atoms.ts (4) - atoms/new-llm-config/new-llm-config-mutation.atoms.ts (4) - atoms/members/members-mutation.atoms.ts (3) - atoms/roles/roles-mutation.atoms.ts (3) - atoms/image-gen-config/image-gen-config-mutation.atoms.ts (3) - atoms/vision-llm-config/vision-llm-config-mutation.atoms.ts (3) - atoms/public-chat-snapshots/public-chat-snapshots-mutation.atoms.ts (2) Atoms intentionally left alone (no local onError, rely on global): auth, user, search-spaces, logs, documents, connectors. Local validation (against dev): pnpm biome check on the 9 touched files is clean; tsc --noEmit shows no new errors in the touched files (pre-existing errors elsewhere unrelated). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
eea2d68098
commit
bf2b4ebeb0
9 changed files with 30 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ export const createNewLLMConfigMutationAtom = atomWithMutation((get) => {
|
|||
|
||||
return {
|
||||
mutationKey: ["new-llm-configs", "create"],
|
||||
meta: { suppressGlobalErrorToast: true },
|
||||
enabled: !!searchSpaceId,
|
||||
mutationFn: async (request: CreateNewLLMConfigRequest) => {
|
||||
return newLLMConfigApiService.createConfig(request);
|
||||
|
|
@ -47,6 +48,7 @@ export const updateNewLLMConfigMutationAtom = atomWithMutation((get) => {
|
|||
|
||||
return {
|
||||
mutationKey: ["new-llm-configs", "update"],
|
||||
meta: { suppressGlobalErrorToast: true },
|
||||
enabled: !!searchSpaceId,
|
||||
mutationFn: async (request: UpdateNewLLMConfigRequest) => {
|
||||
return newLLMConfigApiService.updateConfig(request);
|
||||
|
|
@ -74,6 +76,7 @@ export const deleteNewLLMConfigMutationAtom = atomWithMutation((get) => {
|
|||
|
||||
return {
|
||||
mutationKey: ["new-llm-configs", "delete"],
|
||||
meta: { suppressGlobalErrorToast: true },
|
||||
enabled: !!searchSpaceId,
|
||||
mutationFn: async (request: DeleteNewLLMConfigRequest & { name: string }) => {
|
||||
return newLLMConfigApiService.deleteConfig({ id: request.id });
|
||||
|
|
@ -105,6 +108,7 @@ export const updateLLMPreferencesMutationAtom = atomWithMutation((get) => {
|
|||
|
||||
return {
|
||||
mutationKey: ["llm-preferences", "update"],
|
||||
meta: { suppressGlobalErrorToast: true },
|
||||
enabled: !!searchSpaceId,
|
||||
mutationFn: async (request: UpdateLLMPreferencesRequest) => {
|
||||
return newLLMConfigApiService.updateLLMPreferences(request);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue