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 redux files for settings - Closes #2031 #2072

Merged
merged 14 commits into from May 27, 2019

Conversation

Projects
2 participants
@massao
Copy link
Contributor

commented May 24, 2019

What issue have I solved?

#2031

How have I implemented/fixed it?

  • Removed settings subscriber from redux;
    • Moved setting into localStorage to the middleware.
  • Removed duplicated action;
    • We had an action specific for token, that was removed.
    • Created deepMergeObj helper function to be easier to update settings state.
    • Created validateToken function on settings reducer file, that checks that the active token is enabled on the list and return the proper state if needed;
    • Removed tests and places using this actions.
  • Updated settings middleware.
    • Updated middleware to set the localStorage settings value when the settings are updated.

How has this been tested?

Open Redux Dev Tools, and try dispatching some actions, eg:

{ type: 'SETTINGS_UPDATED', data: { token: { active: 'BTC', list: { BTC: false } } } }
{ type: 'SETTINGS_UPDATED', data: { token: { list: { BTC: true } } } }
{ type: 'SETTINGS_UPDATED', data: { token: { active: 'LSK' } } }
{ type: 'SETTINGS_UPDATED', data: { channels: { academy: true, reddit: true, twitter: false, github: true } } }
{ type: 'SETTINGS_UPDATED', data: { channels: { twitter: true } } }

And check that the state of redux and the localStorage gets updated properly.

Review checklist

massao added some commits May 24, 2019

@massao massao self-assigned this May 24, 2019

massao added some commits May 24, 2019

@massao massao marked this pull request as ready for review May 24, 2019

massao added some commits May 26, 2019

@massao massao requested a review from osvaldovega May 26, 2019

@osvaldovega
Copy link
Contributor

left a comment

looks good 👍🏻

@reyraa reyraa added this to Pull Requests in Version 1.18.0 via automation May 27, 2019

massao added some commits May 27, 2019

@osvaldovega
Copy link
Contributor

left a comment

great

@osvaldovega osvaldovega added the ready label May 27, 2019

@massao massao merged commit 1615d24 into development May 27, 2019

3 checks passed

Jenkins e2e tests e2e tests passed
Details
Jenkins test deployment Commit was deployed to test
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details

Version 1.18.0 automation moved this from Pull Requests to Merged Pull Requests May 27, 2019

@massao massao deleted the 2031-refactor-redux-files-for-settings branch May 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.