-
Notifications
You must be signed in to change notification settings - Fork 60
Isolate core and presentational logics - Closes #611, #610, #584 #636
Conversation
…Api call to actions
src/actions/account.js
Outdated
dispatch(activePeerReset()); | ||
dispatch(transactionsReset()); | ||
dispatch({ type: actionTypes.accountLoggedOut }); | ||
}; |
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.
Each dispatch will handle view re-render. I recommend to using one action that will be handled in different reducers. like, handle logout
in each of it.
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.
Good point. I'll change it
src/components/forging/forging.js
Outdated
import ForgedBlocks from './forgedBlocks'; | ||
|
||
class Forging extends React.Component { | ||
loadStats(key, startMoment) { |
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.
Component do not have a state, better use the stateless one
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.
yeah I forgot to change it
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.
It looks very good.
I found just this small issue:
- cannot introduced in this PR, but related to 'cleaning store after logout':
actionTypes.activePeerReset
should set peer state to{ data: {}, status: {} }
inestead of{ data: null, status: null }
because, else there isTypeError: Cannot read property 'online' of null
when I log out and log back in.
wrapper.find('.username input').simulate('change', { target: { value: 'sample_username' } }); | ||
wrapper.find('.next-button').simulate('click'); | ||
expect(wrapper.find('.primary-button button').props().disabled).to.not.equal(true); | ||
// TODO: this doesn't work for some reason | ||
// expect(props.showSuccessAlert).to.have.been.calledWith(); | ||
expect(props.delegateRegistered).to.have.been.calledWith(); |
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.
The TODO
comment above can be also removed
@@ -10,20 +9,31 @@ class Transactions extends React.Component { | |||
constructor() { | |||
super(); | |||
this.canLoadMore = true; | |||
this.transactionsCount = 0; |
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.
This is not used
src/actions/account.test.js
Outdated
expect(dispatch).to.have.been.calledWith(forgingReset()); | ||
expect(dispatch).to.have.been.calledWith(activePeerReset()); | ||
expect(dispatch).to.have.been.calledWith(transactionsReset()); | ||
expect(dispatch).to.have.property('callCount', 4); |
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.
There is also expect(dispatch).to.have.been.called.exactly(4);
Closes #611
Closes #610
Closes #584