-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Posts: Add single site post requesting behavior to Redux state #3108
Conversation
Test pass locally, woo |
@@ -23,6 +23,9 @@ export const FETCH_SITE_PLANS = 'FETCH_SITE_PLANS'; | |||
export const FETCH_SITE_PLANS_COMPLETED = 'FETCH_SITE_PLANS_COMPLETED'; | |||
export const FETCH_WPORG_PLUGIN_DATA = 'FETCH_WPORG_PLUGIN_DATA'; | |||
export const NEW_NOTICE = 'NEW_NOTICE'; | |||
export const POST_REQUEST = 'POST_REQUEST'; | |||
export const POST_REQUEST_SUCCESS = 'POST_REQUEST_SUCCESS'; | |||
export const POST_REQUEST_FAILURE = 'POST_REQUEST_FAILURE'; |
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.
(note: not really for this PR)
I wonder if we should flip all of these to keymirror... It turns out the const doesn't transfer through the export, so an importer can still reassign the imported variable. I feel like the const
is giving a false sense of security.
But maybe it helps with code completion in some editors?
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 wonder if we should flip all of these to keymirror
What advantage would there be in using keyMirror?
For me at least, this is less about feeling of security with const
and rather in opting to use simple language constructs than an external library that, in my opinion, doesn't provide much value.
There's some discussion in the keyMirror
repository about minifiers crushing keys, though I don't think it affects our situation.
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.
just less duplication. it's really easy to fat finger one side of the const construction and not notice.
MY_REALLY_LONG_KEY = "MY_REALY_LONG_KEY"
vs
keyMirror( { MY_REALLY_LONG_KEY: t } )
I'm not worried about the minifier advantages really. Though that could speed up string compares I guess. Likely meh.
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's really easy to fat finger one side of the const construction and not notice
Maybe some custom lint rules could help here?
Related: #3015, https://github.com/Automattic/eslint-plugin-wpcalypso
Bugs in reducer action handlers causing state to be mutated unintentionally.
Looks good, unleash the 🐲. |
Thanks for the review, @blowery ! Some great discussion/discoveries in this pull request 😄 |
Posts: Add single site post requesting behavior to Redux state
This pull request seeks to implement Redux state behaviors for managing network requests of single site post objects. This will be used as part of the editor Redux migration effort in allowing the editor to reconcile post revisions with the persisted post entity.
Testing instructions:
There are no effective visual changes to test.
Ensure Mocha tests pass by running
make test
in your Terminal from the project root directory or directly fromclient/state/posts
.