Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

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

Merged
mikemilla merged 6 commits into
mainfrom
fix/sup-561-handle-update-preferences-return-type
Apr 13, 2026
Merged

fix: handle RecipientPreference return type from updatePreferences mutation (SUP-561)#681
mikemilla merged 6 commits into
mainfrom
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

linear Bot commented Apr 9, 2026

Copy link
Copy Markdown

…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
xehl
xehl previously approved these changes Apr 13, 2026
Add a standalone page rendering the PreferenceList component with its
own route and navigation link alongside the existing examples.

Made-with: Cursor
- usePreferencesActions now returns promises so callers can await results
- Added e2e test for usePreferences hook (fetch, update, state sync)
- Updated jest configs to load .env from project root

Made-with: Cursor
@mikemilla mikemilla merged commit 8fd378d into main Apr 13, 2026
5 checks passed
@mikemilla mikemilla deleted the fix/sup-561-handle-update-preferences-return-type branch April 13, 2026 20:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants