Skip to content

Commit

Permalink
Revert "Use optional chaining instead of lodash get"
Browse files Browse the repository at this point in the history
This reverts commit 6f0a317.
  • Loading branch information
ellatrix committed Jun 8, 2021
1 parent 77c8ae9 commit 2e0af2f
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions packages/core-data/src/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,20 @@ export const getRawEntityRecord = createSelector(
);
},
( state, kind, name, recordId ) => [
state.entities.data[ kind ]?.[ name ]?.queriedData?.items?.[ recordId ],
state.entities.data[ kind ]?.[ name ]?.queriedData?.itemIsComplete?.[
recordId
],
get( state.entities.data, [
kind,
name,
'queriedData',
'items',
recordId,
] ),
get( state.entities.data, [
kind,
name,
'queriedData',
'itemIsComplete',
recordId,
] ),
]
);

Expand Down Expand Up @@ -369,7 +379,7 @@ export const getEntityRecordNonTransientEdits = createSelector(
},
( state, kind, name, recordId ) => [
state.entities.config,
state.entities.data[ kind ]?.[ name ]?.edits?.[ recordId ],
get( state.entities.data, [ kind, name, 'edits', recordId ] ),
]
);

Expand Down Expand Up @@ -409,11 +419,21 @@ export const getEditedEntityRecord = createSelector(
...getEntityRecordEdits( state, kind, name, recordId ),
} ),
( state, kind, name, recordId ) => [
state.entities.data[ kind ]?.[ name ]?.queriedData?.items?.[ recordId ],
state.entities.data[ kind ]?.[ name ]?.queriedData?.itemIsComplete?.[
recordId
],
state.entities.data[ kind ]?.[ name ]?.edits?.[ recordId ],
get( state.entities.data, [
kind,
name,
'queriedData',
'items',
recordId,
] ),
get( state.entities.data, [
kind,
name,
'queriedData',
'itemIsComplete',
recordId,
] ),
get( state.entities.data, [ kind, name, 'edits', recordId ] ),
]
);

Expand Down

0 comments on commit 2e0af2f

Please sign in to comment.