-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: Move store files into state directory #3030
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3030 +/- ##
==========================================
- Coverage 35.15% 35.14% -0.01%
==========================================
Files 265 277 +12
Lines 6721 6720 -1
Branches 1216 1216
==========================================
- Hits 2363 2362 -1
Misses 3683 3683
Partials 675 675
Continue to review full report at Codecov.
|
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.
LGTM 👍
Merge conflicts need to be resolved and it should be good to go 👍 |
I'll plan to land this one after the next release. |
1746b42
to
bbce2dd
Compare
Rebased and... well, decided to adopt the Ducks pattern here and now. This is now a monster of a pull request and we should decide sooner than later if we want to move on it, as conflicts will become increasingly likely. Its only saving grace is that while I split features, I kept a master reference of Ultimately the Ducks modules ended up being:
|
9d4feec
to
5993dd7
Compare
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'm not totally inside the motivations of this change. But I checked the code and the pattern applied in this refactor seems fine, I think this makes our codebase more scalable and easier to work in parallel in different features. I did an extensive set of tests in this branch and I did not found a regression so I'm approving it
👍 Nice work handling a huge change like this!
A fear I have is with time we may create huge "ducks" and even bigger "ducks" test files. Would a pattern like editor/state/meta-boxes/{actions, reducer, selectors}.js instead of editor/state/meta-boxes.js following the same rules in the "ducks" pattern but with artifacts separated in files be an option? I think this pattern is similar to what happens in wp-calypso.
Yeah, I never had an initial appreciation for how similar Ducks is to the pattern we introduced to Calypso, but in implementing it here, there is certainly significant overlap, with the main difference being that Ducks places more emphasis on the reducer as the default export of a module (maybe equivalent to a |
I had to do some research what Ducks pattern is, but as soon as I learned about it I'm fine with the proposed approach. It also seems to be reasonable to keep two global entry points for actions and selectors. It is much easier to have one place to import things that scan all subfolders for every method. It also ensures that we won't use the same names for different things. Let's rebase and proceed with this one. Next step would be to find a way to make Redux state extensible |
5993dd7
to
4fa0f08
Compare
I'll try to rebase to keep this up-to-date, but I'm beginning to question some of the value here. In particular, subject-based selectors can be confusing to implement, since something like |
In case of |
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.
No idea how to even begin reviewing this; sorry 🤷♂️
I'm mostly dispassionate about it though I encourage grouping functions into fewer files just because of issues with JavaScript.
Please let me know if there are specific ways I can be of assistance here!
I think it's no longer relevant and a bit outdated :) |
Indeed! The ducks pattern is still interesting, though added equal parts clarity and confusion; clarity in creating separation where it clearly exists, confusion in things such as selectors or effects which operate on state as a whole. |
Iterative progress toward #3012
This pull request seeks to move editor state behaviors into a new state directory. This directory will encompass all state behaviors per the modularity approach proposed in #3012. The changes included merely move the state directory and update all references therein. I debated whether subsequent module splitting should be included in these changes, but decided the potential for merge conflicts was too high to sustain.
Testing instructions:
Verify that the editor builds and runs without any errors.
Follow-up Tasks:
We should be careful to find and update any current branches / pull requests which add to or reference state after these changes are merged.