-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
[Package] Core data/packages/core-data/packages/core-data[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Description
What problem does this address?
Currently useEntityRecord exposes almost all of the actions / info you might need relating to the entity record, such as record, save, edit, isResolving, hasResolved etc, but to find out if a save is in progress (to show loaders for example), we have to make a seperate select call with the same paramaters to find out if its saving.
The navigation menu is doing it here:
const { record: navigationMenu, isResolving } = useEntityRecord(
'postType',
postType,
postId
);
const { isSaving, isDeleting } = useSelect(
( select ) => {
const { isSavingEntityRecord, isDeletingEntityRecord } =
select( coreStore );
return {
isSaving: isSavingEntityRecord( 'postType', postType, postId ),
isDeleting: isDeletingEntityRecord(
'postType',
postType,
postId
),
};
},
[ postId ]
);
What is your proposed solution?
It would be nice if useEntityRecord also exposed isSavingEntityRecord and isDeletingEntityRecord as something like isSaving and isDeleting.
Assuming useEntityRecord is supposed to be an easy way to access actions and data about an entity record, then it seems these are the last two pieces of information missing.
spencerfinnell
Metadata
Metadata
Assignees
Labels
[Package] Core data/packages/core-data/packages/core-data[Type] EnhancementA suggestion for improvement.A suggestion for improvement.