-
Notifications
You must be signed in to change notification settings - Fork 26
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: Removes HathorWallet
from Redux store
#580
Merged
Merged
Conversation
This file contains 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
tuliomir
force-pushed
the
refactor/redux-hathorwallet
branch
from
April 9, 2024 21:53
b8307c3
to
49c41d6
Compare
tuliomir
requested review from
andreabadesso and
r4mmer
and removed request for
pedroferreira1
April 11, 2024 17:08
r4mmer
requested changes
Apr 15, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As stated in the review, I think we should remove the wallet from all mapStateToProps
since the objective of this PR is to remove the wallet from redux state.
tuliomir
force-pushed
the
refactor/redux-hathorwallet
branch
from
April 16, 2024 23:53
91d18c4
to
0fe2c6d
Compare
andreabadesso
requested changes
Apr 17, 2024
andreabadesso
approved these changes
Apr 18, 2024
r4mmer
approved these changes
Apr 19, 2024
1 task
1 task
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.
The next version of Redux throws an error by default whenever there are non-serializable objects in its Store ( more about this on this article ). This PR is one in a series of PRs that aim to refactor all of those instances before the upgrade.
The
wallet
Redux property stored is currently used for many operations throughout the whole application. The proposed solution is to:wallet singleton
javascript module, apart from the Redux storeIt is worth noting that we plan on implementing multiple simultaneous wallets in the future ( see #210 ). This refactor also aims to facilitate this feature, while not directly implementing it.
Acceptance Criteria
routerHistory
should not be present on the Redux StoreRationale and Alternatives
Many different approaches were considered for this refactor, the most important ones were using
useRef
anduseContext
. The idea is to keep this wallet instance in a way that does not cause:Since
useContext
is meant to deal with serializable data that will affect rendering, it was not an option for this solution. Creating a new component and applyinguseRef
would be a possibility, but this would not offer any benefit over a common javascript singleton.So, the decided solution was to implement a singleton for the application
HathorWallet
instance.Security Checklist