-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix newError noops when not bound to dispacher #4013
Conversation
} | ||
|
||
export default connect( | ||
mapStateToProps, |
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 just an optimisation:
If you omit [
mapDispatchToProps
], the component will not be subscribed to the Redux store.
You could pass null
, it occurs multiple times in the codebase already.
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.
I generally prefer being explicit and in a once-off situation being explicit about an empty state is not bad. However who knows what happens with Redux making that call each cycle as things changes, it just add unnecessary overheads.
Will update.
|
||
describe('onAdd', () => { | ||
it('calls store addContract', () => { | ||
sinon.stub(instance.store, 'addContract').resolves(true); |
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.
I think in this case it's not worth it yet, but once we have more stubs, restoring them can easily be forgotten (which breaks the whole point of the stubs then). sandboxes try to address this issue.
@@ -138,6 +142,24 @@ export default class EditMeta extends Component { | |||
|
|||
return this.store | |||
.save() | |||
.then(() => this.props.onClose()); | |||
.then(() => this.props.onClose()) | |||
.catch((error) => { |
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.
👍
} | ||
|
||
export default connect( | ||
mapStateToProps, |
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 above.
Changes Unknown when pulling f0cc5a3 on jg-newError-bindings into ** on master**. |
newError in AddContract, EditMeta & PasswordManager was not properly bound.