Skip to content

Commit

Permalink
Fix the JSDoc return type for getEntityRecords (#21630)
Browse files Browse the repository at this point in the history
* Fix the JSDoc return type for getEntityRecords

`getEntityRecords` can actually return null based on the return type
of `getQueriedItems` which it calls. I can confirm it behaves this
way in the implementation so its a bug with JSDoc type for
getEntityRecords.

I did wonder if this would be desired behaviour though. Since
getEntityRecords is a selector I think it could make more sense
for it to always return an empty array to represent its empty state.

* Run docs:build
  • Loading branch information
samueljseay authored Apr 17, 2020
1 parent a32e961 commit 6074400
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/designers-developers/developers/data/data-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ _Parameters_

_Returns_

- `Array`: Records.
- `?Array`: Records.

<a name="getLastEntitySaveError" href="#getLastEntitySaveError">#</a> **getLastEntitySaveError**

Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ _Parameters_

_Returns_

- `Array`: Records.
- `?Array`: Records.

<a name="getLastEntitySaveError" href="#getLastEntitySaveError">#</a> **getLastEntitySaveError**

Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const getRawEntityRecord = createSelector(
* @param {string} name Entity name.
* @param {?Object} query Optional terms query.
*
* @return {Array} Records.
* @return {?Array} Records.
*/
export function getEntityRecords( state, kind, name, query ) {
const queriedState = get( state.entities.data, [
Expand Down

0 comments on commit 6074400

Please sign in to comment.