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

Refactor token selectors #8671

Merged
merged 1 commit into from
May 29, 2020
Merged

Refactor token selectors #8671

merged 1 commit into from
May 29, 2020

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented May 28, 2020

Unused token selectors have been removed, and the remaining token selector has been moved to the metamask Redux store.

Base automatically changed from refactor-transaction-token-filtering to develop May 28, 2020 03:11
Unused token selectors have been removed, and the remaining token
selector has been moved to the `metamask` Redux store.
@Gudahtt Gudahtt force-pushed the refactor-token-selectors branch from 88fcfdb to 49066f3 Compare May 28, 2020 22:08
@Gudahtt Gudahtt marked this pull request as ready for review May 28, 2020 22:29
@Gudahtt Gudahtt requested a review from a team as a code owner May 28, 2020 22:29
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

Why is ducks the right place for getTokens?

Edit: More generally, where are our selectors going to live?

@metamaskbot
Copy link
Collaborator

Builds ready [49066f3]
Page Load Metrics (611 ± 53 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint318542157
domContentLoaded34673460911053
load34873661111053
domInteractive34673460911053

@Gudahtt
Copy link
Member Author

Gudahtt commented May 28, 2020

I would like selectors to live alongside the Redux stores they select from, as in the new alert stores. Co-locating the selectors with the store itself encapsulates knowledge of the state shape to this single module.

Ideally all of our stores would behave this way: self-contained state-machines that control their own state (except the metamask store, which is like a proxy store).

Selectors will likely still have to exist in other places as well, to perform post-processing specific to certain areas of the UI, or to combine data from different stores, but those can be built up from the store selectors without them needing to understand the internal store structure.

@rekmarks rekmarks self-requested a review May 28, 2020 22:54
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

LGTM!

@Gudahtt Gudahtt merged commit 88bed71 into develop May 29, 2020
@Gudahtt Gudahtt deleted the refactor-token-selectors branch May 29, 2020 00:43
Gudahtt added a commit that referenced this pull request Jun 1, 2020
* origin/develop: (689 commits)
  Implement asset page (#8696)
  fix crash on signature request (#8709)
  Fix accounts menu styling (#8707)
  Delete docs/porting_to_new_environment.md (#8704)
  Remove unused `getToErrorObject` parameters (#8705)
  hide connected-status on metamask ext (#8703)
  Stop adding permissions middleware to trusted connections (#8701)
  Use `send` state for send flow token (#8695)
  do not display extension id in connection modal (#8699)
  Fix tab content disappearing during scrolling on macOS Firefox (#8702)
  close details when button is pressed (#8694)
  Refactor token selectors (#8671)
  Update eth_accounts permission description (#8693)
  Extract selected token from token input (#8692)
  Fix propType for Home defaultHomeActiveTabName (#8683)
  Fix create account form styling (#8689)
  Remove unused `getSelectedTokenAssetImage` selector (#8691)
  Remove `getTxParams` (#8676)
  do not show account mismatch alert on details (#8678)
  Fix connect hardware styling (#8680)
  ...
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.

3 participants