-
Notifications
You must be signed in to change notification settings - Fork 4.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
Fix#7378 - Changing accumulator variable names #17915
Conversation
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.
Nice improvements. Can we address two more comments where I suggest we remove redundant prefixes result
and memo
from the variable names? They are the same I shared in #17893 😄
Otherwise, it looks great. Many thanks for cleaning up the code.
@@ -67,8 +67,8 @@ function mapBlockOrder( blocks, rootClientId = '' ) { | |||
* @return {Object} Block order map object. | |||
*/ | |||
function mapBlockParents( blocks, rootClientId = '' ) { | |||
return blocks.reduce( ( result, block ) => Object.assign( | |||
result, | |||
return blocks.reduce( ( resultAccumulator, block ) => Object.assign( |
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 seems like resultAccumulator
could be simplified to just accumulator
. They result
prefix doesn't sound like it brings additional context here.
packages/data/src/store/index.js
Outdated
@@ -16,8 +16,8 @@ function createCoreDataStore( registry ) { | |||
'hasFinishedResolution', | |||
'isResolving', | |||
'getCachedResolvers', | |||
].reduce( ( memo, selectorName ) => ( { | |||
...memo, | |||
].reduce( ( memoAccumulator, selectorName ) => ( { |
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.
A similar note here. It feels like memoAccumulator
could be shortened to accumulator
and it will read well enough.
I have just merged #17893 from @lozinska and it looks like you both applied changes to |
@gziolo I will work on this. Thanks. |
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 2 more files to update and some conflicts to resolve and we're ready to go! 😄
@@ -19,26 +19,26 @@ import { REDUCER_KEY } from './name'; | |||
// Instead of getEntityRecord, the consumer could use more user-frieldly named selector: getPostType, getTaxonomy... | |||
// The "kind" and the "name" of the entity are combined to generate these shortcuts. | |||
|
|||
const entitySelectors = defaultEntities.reduce( ( result, entity ) => { | |||
const entitySelectors = defaultEntities.reduce( ( resultAccumulator, entity ) => { |
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.
Can we have those renamed to accumulator
too?
@@ -33,10 +33,10 @@ const gutenbergPackages = Object.keys( dependencies ) | |||
|
|||
module.exports = { | |||
mode, | |||
entry: gutenbergPackages.reduce( ( memo, packageName ) => { | |||
entry: gutenbergPackages.reduce( ( memoAccumulator, packageName ) => { |
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.
Same as above! 🙏
Looks like this needs to be rebased with |
This one got completely out of date is no longer actionable. Thank you so much for working on it. We can always reopen when this branch gets refreshed. |
Description
Fixes #7378.
Changed accumulator variable names
Checklist: