refactor: removes quotes from ramp controller state#8013
Open
georgeweiler wants to merge 6 commits intomainfrom
Open
refactor: removes quotes from ramp controller state#8013georgeweiler wants to merge 6 commits intomainfrom
georgeweiler wants to merge 6 commits intomainfrom
Conversation
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
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.
Explanation
Refactor
RampsControllerso quote and widget URL data are no longer kept in shared state. The controller is now a fetch-and-cache layer only; consumers manage quote and widget URL state themselves.This removes the race where quotes became inconsistent when opening and closing PaymentSelectionModal (e.g., when
fetchQuotesForSelectionoverwrotestate.quotes.datawith single-payment-method responses).Changes
RampsController.ts
state.quotesandstate.widgetUrlfrom state type, metadata, and default statefetchQuotesForSelection()— consumers callgetQuotes()directlysetSelectedQuote()— consumers manage selection locally#syncWidgetUrland all its usagesgetQuotes()to fetch-and-return only (no state writes, noskipStateUpdate, noresourceType: 'quotes')getWidgetUrl()as a pure fetch-and-return API'quotes'fromDEPENDENT_RESOURCE_KEYSand allresetWidgetUrlusage insetSelectedProvider,setSelectedToken, andresetDependentResourcesRequestCache.ts
'quotes'fromResourceTypeBreaking Changes
state.quotesandstate.widgetUrl— Quote and widget URL data are now managed by consuming componentsfetchQuotesForSelection()— Removed; callgetQuotes()directly with desired paramssetSelectedQuote()— Removed; manage selection in local component stateskipStateUpdateingetQuotes()— Removed;getQuotes()no longer writes to stateReferences
Checklist
Note
Medium Risk
This is a breaking API/state shape change that requires coordinated consumer updates; runtime risk is mainly in downstream integrations expecting
state.quotes/state.widgetUrlor selection side effects.Overview
Refactors
RampsControllerto stop storing quotes and widget URL in shared controller state, making it primarily a fetch + request-cache layer while consumers manage quote selection and widget URL locally.Removes the
quotes/widgetUrlstate slices and related reset/selection APIs (fetchQuotesForSelection(),setSelectedQuote(), and widget URL sync logic), and updatesgetQuotes()/getWidgetUrl()to be pure fetch-and-return methods (no state writes). Tests andRequestCacheresource typing are updated accordingly, and the changelog marks these as breaking.Written by Cursor Bugbot for commit 4c8688c. This will update automatically on new commits. Configure here.