Skip to content

Commit

Permalink
Pass registry as the 3rd param to mapSelectToProps in withSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Nov 28, 2018
1 parent 59ec0a1 commit d9925fe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/data/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### New Feature

- `withDispatch`'s `mapDispatchToProps` function takes the `registry` object as the 3rd param ([#11851](https://github.com/WordPress/gutenberg/pull/11851)).
- `withSelect`'s `mapSelectToProps` function takes the `registry` object as the 3rd param ([#11851](https://github.com/WordPress/gutenberg/pull/11851)).

## 4.0.1 (2018-11-20)

Expand Down
2 changes: 1 addition & 1 deletion packages/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ A higher-order component is a function which accepts a [component](https://githu

#### `withSelect( mapSelectToProps: Function ): Function`

Use `withSelect` to inject state-derived props into a component. Passed a function which returns an object mapping prop names to the subscribed data source, a higher-order component function is returned. The higher-order component can be used to enhance a presentational component, updating it automatically when state changes. The mapping function is passed the [`select` function](#select) and the props passed to the original component.
Use `withSelect` to inject state-derived props into a component. Passed a function which returns an object mapping prop names to the subscribed data source, a higher-order component function is returned. The higher-order component can be used to enhance a presentational component, updating it automatically when state changes. The mapping function is passed the [`select` function](#select), the props passed to the original component and the `registry` object.

_Example:_

Expand Down
2 changes: 1 addition & 1 deletion packages/data/src/components/with-select/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const withSelect = ( mapSelectToProps ) => createHigherOrderComponent( ( Wrapped
*/
function getNextMergeProps( props ) {
return (
mapSelectToProps( props.registry.select, props.ownProps ) ||
mapSelectToProps( props.registry.select, props.ownProps, props.registry ) ||
DEFAULT_MERGE_PROPS
);
}
Expand Down

0 comments on commit d9925fe

Please sign in to comment.