Skip to content

fix: handle RecipientPreference return type from updatePreferences mutation (SUP-561)#681

Open
mikemilla wants to merge 2 commits intomainfrom
fix/sup-561-handle-update-preferences-return-type
Open

fix: handle RecipientPreference return type from updatePreferences mutation (SUP-561)#681
mikemilla wants to merge 2 commits intomainfrom
fix/sup-561-handle-update-preferences-return-type

Conversation

@mikemilla
Copy link
Copy Markdown
Contributor

Summary

  • The backend updatePreferences mutation now returns a RecipientPreference object instead of Void (backend PR #9335)
  • Updated the SDK mutation to select the return fields (templateId, status, hasCustomRouting, routingPreferences, digestSchedule)
  • The SDK now uses the server-returned data instead of echoing back the input payload, so the reducer state always reflects the true server state
  • GraphQL errors are now properly thrown (previously silently swallowed), with a new ERROR reducer case and error field on PreferenceState

Changes

  • packages/client-graphql/src/preferences.ts — Updated mutation query to select RecipientPreference fields; return server response data; throw on GraphQL errors
  • packages/react-hooks/src/preferences/reducer.ts — Clear error on success; handle UPDATE_RECIPIENT_PREFERENCES/ERROR action
  • packages/react-hooks/src/preferences/types.ts — Added error?: Error to PreferenceState

Test plan

Ran 23 integration tests against dev shared — all passing.

  • Mutation returns full RecipientPreference object (not null)
  • Status update round-trip (set, query, reset)
  • digestSchedule update round-trip
  • digestSchedule with accountId (SUP-561 customer scenario)
  • Reducer correctly merges server response into state
  • Routing preferences update (hasCustomRouting + routingPreferences)
  • GraphQL error propagation (bad auth triggers thrown error)

Made with Cursor

@linear
Copy link
Copy Markdown

linear bot commented Apr 9, 2026

…tation (SUP-561)

The updatePreferences mutation now returns a RecipientPreference object
instead of Void. Updated the SDK to select return fields, use server
response data, and propagate GraphQL errors.

Made-with: Cursor
@mikemilla mikemilla force-pushed the fix/sup-561-handle-update-preferences-return-type branch from 5089384 to 681642b Compare April 10, 2026 17:35
The backend returns RecipientPreference from the existing
updatePreferences mutation, no need for a V2 endpoint.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant