Skip to content

Conversation

@vovacodes
Copy link
Contributor

Just wanted to clarify a confusing moment: "shall I always call side-effects through sending an action?"
React docs say that you should never call setState in componentWillUnmount and this.send eventually calls setState, so I believe we should make it clear that we shouldn't call this.send in componentWillUnmount either.

What do you think?

@codecov
Copy link

codecov bot commented Aug 3, 2018

Codecov Report

Merging #15 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #15   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           4      4           
  Lines          61     61           
  Branches       13     13           
=====================================
  Hits           61     61

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dcba695...ecdb425. Read the comment docs.

Copy link
Owner

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

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

Excellent, thank you!

In general, it's safe to directly call side-effects inside any callbacks of the commit phase as well (cDM, cDU). Using send() in those cases will work but it might also trigger a cascading update which might be unexpected.

@philipp-spiess philipp-spiess merged commit 9567374 into philipp-spiess:master Aug 3, 2018
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.

2 participants