-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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: Extract "edit-post" to its own module #3649
Conversation
4ac2001
to
ff3f9b1
Compare
Codecov Report
@@ Coverage Diff @@
## master #3649 +/- ##
==========================================
- Coverage 37.32% 37.31% -0.01%
==========================================
Files 277 284 +7
Lines 6685 6692 +7
Branches 1213 1206 -7
==========================================
+ Hits 2495 2497 +2
- Misses 3532 3544 +12
+ Partials 658 651 -7
Continue to review full report at Codecov.
|
ff3f9b1
to
285e9a7
Compare
I took a quick glance at this code. Looks pretty good.
I'm not so happy about passing it down to all those components. I will think about some alternatives. |
@@ -1,7 +1,7 @@ | |||
/** | |||
* Internal dependencies | |||
*/ | |||
import scssVariables from '!!sass-variables-loader!./assets/stylesheets/_variables.scss'; | |||
import scssVariables from '!!sass-variables-loader!../edit-post/assets/stylesheets/_variables.scss'; |
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 like some SCSS variables should remain located in editor/
folder.
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, we have this issue for all components, these variables and mixins are not modularized properly. They are used in all the modules "components, "block", "editor", "edit-post" and a lot of them are specific to a module.
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.
We should tackle this separately in that case.
285e9a7
to
af231de
Compare
af231de
to
d8a28c2
Compare
We discussed it extensively on Slack, but let me summarize my feedback here. So as I understand, the idea here is to have isolated Redux state for the editor and a separate one for I’m not happy about It's passed down from I was exploring if we could reuse pattern from <AdvancedSettings>
{ ( areAdvancedSettingActive, closeAdvancedSettings ) => areAdvancedSettingActive && <Sidebar onClose={ closeAdvancedSettings } /> }
</AdvancedSettings> This would solve the nesting issue, but the obvious issue here is that it won't play well with the modal case. It would be nice to gather feedback from @mkaz and @georgeh how this proposal fits with their work on P2 integration. It would be a very valuable to hear from them before we proceed. |
One more thing to consider. Previously only |
I'm closing this right now, I'll do another attempt once the "data" module finalized, which will help with state access accross modules. |
Sorry for the huge PR, sometimes there's no alternative.
This PR extracts the
edit-post
module to its own module. This surfaced some "issues"The need to spit the store into two stores. One store for the "editor" module (library) which is more a "local state" to the
EditorProvider
component. This store is saved in the React context using a different key "editorStore" to avoid ambiguity when callingconnect
Some components in
edit-post
where still needed access to theeditor
module's store, in general this is fixed by adding reusable components to theeditor
module.The "Show block inspector" button proved to be a challenge, because the idea is that clicking this button shows the inspector, but since the BlockInspector is a reusable component that can be shown anyware in the application using the "editor" module, we needed a
showBlockInspector
to allow the surrouding application (edit-post
) to handle this button properly.I'd appreciate quick feedback and opinions, this won't be enought to keep without conflicts and continuous rebasing.
Testing instructions