Skip to content

Expose isSavingEntityRecord and isDeletingEntityRecord when using useEntityRecord #56471

Open
@rmorse

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions