Replace network state with networkId and networkStatus#1196
Merged
Conversation
087e0f5 to
03739b1
Compare
The network controller `network` state used to be set to `loading` if the network was loading or uninitialized, or to the network ID if the network had finished loading. Effectively it was tracking both the network ID for the current selected network, and the network status. This state property has been split in two; now we track the network ID of the current selected network separately from the network status. The network status has been expanded to include more states as well. Closes #1020
03739b1 to
fb98499
Compare
legobeat
reviewed
Apr 18, 2023
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
mcmire
reviewed
Apr 18, 2023
Contributor
mcmire
left a comment
There was a problem hiding this comment.
Makes sense! Just had a single suggestion.
packages/transaction-controller/src/TransactionController.test.ts
Outdated
Show resolved
Hide resolved
Merged
Gudahtt
added a commit
that referenced
this pull request
May 10, 2023
The network change handler for the ENS controller has been broken since the PR #1170 due to a conflict with #1196, which was merged around the same time. It referenced the `network` property of the network state that we have removed. The change handler has been updated to use `networkId` instead. Additionally, the `NetworkState` type has been imported so that we're less likely to make this mistake again.
Gudahtt
added a commit
that referenced
this pull request
May 10, 2023
The network change handler for the ENS controller has been broken since the PR #1170 due to a conflict with #1196, which was merged around the same time. It referenced the `network` property of the network state that we have removed. The change handler has been updated to use `networkId` instead. Additionally, the `NetworkState` type has been imported so that we're less likely to make this mistake again.
3 tasks
Gudahtt
added a commit
that referenced
this pull request
May 10, 2023
The network change handler for the ENS controller has been broken since the PR #1170 due to a conflict with #1196, which was merged around the same time. It referenced the `network` property of the network state that we have removed. The change handler has been updated to use `networkId` instead. Additionally, the `NetworkState` type has been imported so that we're less likely to make this mistake again.
Gudahtt
added a commit
that referenced
this pull request
May 10, 2023
The network change handler for the ENS controller has been broken since the PR #1170 due to a conflict with #1196, which was merged around the same time. It referenced the `network` property of the network state that we have removed. The change handler has been updated to use `networkId` instead. Additionally, the `NetworkState` type has been imported so that we're less likely to make this mistake again.
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
* Replace `network` state with `networkId` and `networkStatus` The network controller `network` state used to be set to `loading` if the network was loading or uninitialized, or to the network ID if the network had finished loading. Effectively it was tracking both the network ID for the current selected network, and the network status. This state property has been split in two; now we track the network ID of the current selected network separately from the network status. The network status has been expanded to include more states as well. Closes #1020 * Clarify description Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> * Adjust types used in tests --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
The network change handler for the ENS controller has been broken since the PR #1170 due to a conflict with #1196, which was merged around the same time. It referenced the `network` property of the network state that we have removed. The change handler has been updated to use `networkId` instead. Additionally, the `NetworkState` type has been imported so that we're less likely to make this mistake again.
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
* Replace `network` state with `networkId` and `networkStatus` The network controller `network` state used to be set to `loading` if the network was loading or uninitialized, or to the network ID if the network had finished loading. Effectively it was tracking both the network ID for the current selected network, and the network status. This state property has been split in two; now we track the network ID of the current selected network separately from the network status. The network status has been expanded to include more states as well. Closes #1020 * Clarify description Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> * Adjust types used in tests --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
The network change handler for the ENS controller has been broken since the PR #1170 due to a conflict with #1196, which was merged around the same time. It referenced the `network` property of the network state that we have removed. The change handler has been updated to use `networkId` instead. Additionally, the `NetworkState` type has been imported so that we're less likely to make this mistake again.
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
The network controller
networkstate used to be set toloadingif the network was loading or uninitialized, or to the network ID if the network had finished loading. Effectively it was tracking both the network ID for the current selected network, and the network status.This state property has been split in two; now we track the network ID of the current selected network separately from the network status. The network status has been expanded to include more states as well.
Changes
networkstate has been replaced bynetworkIdandnetworkStatusnetworkto access the network ID, usenetworkIdnow instead. It will be set tonullrather thanloadingif the network is not currently available.networkto see if the network was currently available, usenetworkStatusinstead. It will be set toNetworkStatus.Availableif the network is available.References
Relates to #1020
Checklist