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
Framework: Merge our two initialization actions into a single onee #2933
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2933 +/- ##
=======================================
Coverage 33.92% 33.92%
=======================================
Files 193 193
Lines 5701 5701
Branches 1000 1000
=======================================
Hits 1934 1934
Misses 3187 3187
Partials 580 580
Continue to review full report at Codecov.
|
Will take a closer look at this shortly. One concern which was already raised (by @mtias) about how we initialize state for the editor is that effects cause some of the details to be lost by the indirection. Part of this is acknowledged by the nature of side-effects (not necessary to be known how an action is handled), but it's hard to argue against the worry that it's unclear at a glance of |
I share these thoughts, it's not easy to know what's happening on initialization and part of this IMO is caused by the fact that it's spread between several competing actions/effects.
Since all of this is synchronous, I think it makes sense to flatten everything into a unique action and move all the behavior to the reducer. It makes things simpler. |
Hmm, maybe. Something has always felt off to me about performing heavy work in a reducer. Perhaps this is partly due to concerns in a bundle-split application where a reducer would need to be present for all bundles (and therefore all code it depends on). Of course, some transformation in a reducer is to be expected, and parsing the input post object could just be seen as one of these transformations. I don't think that an effect need exist based on whether it is synchronous or asynchronous, but I do agree how we're currently using it -- as a transform step between a simple editor initialization and the reducer -- doesn't really fall under the classification of "side effect", and we should move the parsing to one or the other ends of this and drop the effect. |
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.
Other conversation notwithstanding, this is a good first step 👍
Just a small refactoring merging our two initialization actions into a single one
SETUP_EDITOR
. As a follow up we could imagine dropping theSETUP_EDITOR
effect entirely, all its behavior is synchronous and could be moved to the reducer, but it serves as a factorization for some processing (parsing).Testing instructions