Repository navigation
fix(mui-favorites): read favorites from unwrapped settings PUT response - #952
Merged
Merged
Conversation
The Settings API PUT returns the saved settings object directly ({ favorites, scope }),
not wrapped in a settings array like GET. Read it with its own response type, and
return the unwrapped body from the MSW mock to match the real service.
jordan-a-young
requested review from
LauRoxx and
gregmartDOTin
as code owners
October 27, 2026 16:46
Contributor
|
🚀 Preview deployed! |
LauRoxx
approved these changes
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a crash on every add/remove of a favorite in
@availity/mui-favorites3.x (Cannot read properties of undefined (reading '0'), reported from clip-ui on TST).The Settings API PUT returns the saved settings object directly, not wrapped in a
settingsarray like GET:{ "favorites": [ { "id": "123", "pos": 0 } ], "scope": { "applicationId": "Gateway-AvNavigation", ... } }Verified against the service source (
availity/onb/epum/settings-service/settings-service,SettingsController.putSettings, which returns the request body minusscope, plusscope).3.0.0 (
cc22bb4a2) read PUT asresponse.data.settings[0].favorites, and the MSW mock was changed to wrap the PUT body to match. The tests echoed the request, so they passed against the broken code.Changes
utils.ts: separateFavoritesGetResponse(settings[]) andFavoritesPutResponse(favorites) types.submit()readsresponse.data.favorites.handlers.ts(@availity/mock): PUT returns the body unwrapped, matching the real service.Favorites.test.tsx: two regression tests that override the PUT with a hardcoded unwrapped response (add and remove). Both fail onmainwith the reported error.Testing
nx run mui-favorites:test: 11/11 passnx run-many -t lint,build -p mui-favorites @availity/mock: passnx affected -t test lint --base=main: passNotes
avataronly uses GET.docs/openapi.yaml) definesSettingsPutResponseonly as{ scope }plus additional properties, which is too loose to catch this. Worth raising with the ONB team.