Skip to content

Commit

Permalink
Depend only on record ID
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed May 24, 2021
1 parent 5653001 commit 373677b
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions packages/core-data/src/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,22 @@ export const getRawEntityRecord = createSelector(
}, {} )
);
},
( state, kind, name ) => [ get( state.entities.data, [ kind, name ] ) ]
( state, kind, name, recordId ) => [
get( state.entities.data, [
kind,
name,
'queriedData',
'items',
recordId,
] ),
get( state.entities.data, [
kind,
name,
'queriedData',
'itemIsComplete',
recordId,
] ),
]
);

/**
Expand Down Expand Up @@ -361,9 +376,9 @@ export const getEntityRecordNonTransientEdits = createSelector(
return acc;
}, {} );
},
( state, kind, name ) => [
( state, kind, name, recordId ) => [
state.entities.config,
[ get( state.entities.data, [ kind, name ] ) ],
get( state.entities.data, [ kind, name, 'edits', recordId ] ),
]
);

Expand Down Expand Up @@ -402,7 +417,23 @@ export const getEditedEntityRecord = createSelector(
...getRawEntityRecord( state, kind, name, recordId ),
...getEntityRecordEdits( state, kind, name, recordId ),
} ),
( state, kind, name ) => [ get( state.entities.data, [ kind, name ] ) ]
( state, kind, name, 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 373677b

Please sign in to comment.