fix: [UIE-10603] - Increase profile preferences reliability#13547
Open
abailly-akamai wants to merge 5 commits intolinode:developfrom
Open
fix: [UIE-10603] - Increase profile preferences reliability#13547abailly-akamai wants to merge 5 commits intolinode:developfrom
abailly-akamai wants to merge 5 commits intolinode:developfrom
Conversation
abailly-akamai
commented
Mar 31, 2026
| const existingPreferences = await getUserPreferences(); | ||
| if (!isPreferencesMergeBase(existingPreferences)) { | ||
| throw PREFERENCES_MERGE_FAILED; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
IF
- The mutation fails — the promise rejects with
PREFERENCES_MERGE_FAILED(same shape as other API errors: [{ reason: '...' }]). - onError runs — preferences query is invalidated, so the client refetches and tries to realign with the server.
- Nothing is PUT from this attempt — we never call
updateUserPreferenceswith a bad merge base, so we avoid the catastrophic case “spread undefined / wrong shape and replace the blob with almost nothing.”
abailly-akamai
commented
Mar 31, 2026
| preferences, | ||
| preferencesLoading, | ||
| preferencesError, | ||
| ]); |
Contributor
Author
There was a problem hiding this comment.
I think this one has always been questionable and a potential culprit for the faulty reset
b0c987c to
ccca94f
Compare
Collaborator
Cloud Manager UI test results🔺 1 failing test on test run #9 ↗︎
Details
TroubleshootingUse this command to re-run the failing tests: pnpm cy:run -s "cypress/e2e/core/objectStorage/object-storage.e2e.spec.ts" |
|||||||||||||||||
bnussman-akamai
approved these changes
Apr 1, 2026
Comment on lines
+66
to
+68
| if (!isPreferencesMergeBase(existingPreferences)) { | ||
| throw PREFERENCES_MERGE_FAILED; | ||
| } |
Member
There was a problem hiding this comment.
Wondering if this is necessary now that we use ensureQueryData.
Suggested change
| if (!isPreferencesMergeBase(existingPreferences)) { | |
| throw PREFERENCES_MERGE_FAILED; | |
| } |
Here, existingPreferences comes directly from the API, which (I think) has pretty strict validation, meaning it will always return a JSON-shaped object { ... }. If something goes wrong fetching initial preferences, ensureQueryData will throw so I don't think this chunk of code will ever be hit. Maybe we can remove it?
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.
Description 📝
We keep receiving reports of preferences in Cloud Manager being randomly reset.
This PR hardens Cloud Manager’s profile preferences flow so we stop silent destructive PUTs.
Changes 🔄
accordionClicked/updatePreferenceson load when collapsedSideNavProductFamilies was unset. Accordion open state for “no saved preference” is now derived in UI from the active route, so we don’t persist nav state on mount and trigger extra merge traffic.ensureQueryDatawhen mutating preferences: we want to make sure we have up to date data before PUTStill a potential risk:
Concurrent PUTs (two updates in flight) can still “last write wins”; we could add a global queue, which is something I will consider once this endpoint is being ported to ORION.
Scope 🚢
Upon production release, changes in this PR will be visible to:
How to test 🧪
Reproduction steps
Hard to reproduce, but reported on production accounts by internal and external users.
Verification steps
/profile/preferencesAuthor Checklists
As an Author, to speed up the review process, I considered 🤔
👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support
As an Author, before moving this PR from Draft to Open, I confirmed ✅