Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove TokenRateController setters #1505

Merged
merged 3 commits into from
Jul 14, 2023
Merged

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Jul 14, 2023

Explanation

The TokenRateController setters for chainId and tokens have been removed. These were confusing, unnecessary, and presented obstacles to testing asynchronous events triggered by these setters.

References

This is tangentially related to #1466

Changelog

@metamask/assets-controllers

  • BREAKING: Remove TokenRatecontroller setter for chainId and tokens properties

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@Gudahtt

This comment was marked as resolved.

@Gudahtt Gudahtt force-pushed the token-rates-stop-polling-by-default branch from bac0a6d to 9dc6817 Compare July 14, 2023 16:36
@Gudahtt Gudahtt force-pushed the remove-token-rate-controller-setters branch from 4c826b4 to 1a69576 Compare July 14, 2023 17:05
@Gudahtt Gudahtt force-pushed the token-rates-stop-polling-by-default branch from 2224382 to 4ecf59d Compare July 14, 2023 20:14
@Gudahtt Gudahtt force-pushed the remove-token-rate-controller-setters branch from 1a69576 to 0bb28c8 Compare July 14, 2023 20:47
Base automatically changed from token-rates-stop-polling-by-default to main July 14, 2023 22:35
The `TokenRateController` setters for `chainId` and `tokens` have been
removed. These were confusing, unnecessary, and presented obstacles to
testing asynchronous events triggered by these setters.
@Gudahtt Gudahtt force-pushed the remove-token-rate-controller-setters branch from 303fe77 to 5334002 Compare July 14, 2023 22:46
@@ -272,8 +272,7 @@ describe('TokenRatesController', () => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
tokenStateChangeListener!({ tokens: [], detectedTokens: [] });

// FIXME: This is now being called twice
Copy link
Member Author

Choose a reason for hiding this comment

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

Removing the setters fixed this bug! The configure call was triggering both the chain ID and the tokens setter, resulting in a double update

@Gudahtt Gudahtt marked this pull request as ready for review July 14, 2023 22:49
@Gudahtt Gudahtt requested a review from a team as a code owner July 14, 2023 22:49
@Gudahtt Gudahtt merged commit 91ae4dc into main Jul 14, 2023
@Gudahtt Gudahtt deleted the remove-token-rate-controller-setters branch July 14, 2023 23:00
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
* Remove `TokenRateController` setters

The `TokenRateController` setters for `chainId` and `tokens` have been
removed. These were confusing, unnecessary, and presented obstacles to
testing asynchronous events triggered by these setters.

* Fix token initialization

* Lint fix
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
* Remove `TokenRateController` setters

The `TokenRateController` setters for `chainId` and `tokens` have been
removed. These were confusing, unnecessary, and presented obstacles to
testing asynchronous events triggered by these setters.

* Fix token initialization

* Lint fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants