Skip to content

Reset swaps routeState in navigateBackToBuildQuote#10166

Merged
Gudahtt merged 1 commit intodevelopfrom
fix-back-button-on-swaps-loading
Jan 22, 2021
Merged

Reset swaps routeState in navigateBackToBuildQuote#10166
Gudahtt merged 1 commit intodevelopfrom
fix-back-button-on-swaps-loading

Conversation

@danjm
Copy link
Copy Markdown
Contributor

@danjm danjm commented Jan 8, 2021

This PR fixes the back button on the swaps loading quotes page.

#9994 removed a call to resetSwapsPostFetchState from the navigateBackToBuildQuote method. This was done to stop clearing some state that was needed on first render of the build quote component, and then subsequently cleared anyway in a useEffect call in the build quote screen.

Due to some unnecessary complexity and messy inter-dependencies within our routing logic, removing the resetSwapsPostFetchState call removed one piece of state clearing that was needed before the history.push(BUILD_QUOTE_ROUTE) call within navigateBackToBuildQuote: resetting routeState from 'loading' to ''. If that was not reset, the component passed to the render property of the FeatureToggledRoute for the BUILD_QUOTE_ROUTE in pages/swaps/index.js would redirect to the LOADING_QUOTES_ROUTE (See lines 276-289 of pages/swaps/index.js)

This PR ensures the resetting of the route state is done before the history.push call in navigateBackToBuildQuote. This fixes the back button on the loading quotes screen, while maintaining the fix to the issue that was fixed in #9994

@danjm danjm requested a review from a team as a code owner January 8, 2021 18:42
@danjm danjm requested a review from rekmarks January 8, 2021 18:42
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 8, 2021

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [2d40c0c]
Page Load Metrics (533 ± 45 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint318148126
domContentLoaded2857345319345
load2877355339345
domInteractive2857345319345

Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! LGTM

@Gudahtt Gudahtt merged commit b1fc4ad into develop Jan 22, 2021
@Gudahtt Gudahtt deleted the fix-back-button-on-swaps-loading branch January 22, 2021 19:00
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants