Skip to content

Conversation

@adamziel
Copy link
Contributor

What?

The usage example added in Add mutations data and helper functions to useEntityRecord proposes storing updates via useState. However, the new mutation helpers can store them directly in the entity record. This PR updates the example to do just that.

cc @gziolo

@adamziel adamziel added [Type] Developer Documentation Documentation for developers [Package] Core data /packages/core-data Developer Experience Ideas about improving block and theme developer experience labels Aug 16, 2022
@adamziel adamziel requested a review from nerrad as a code owner August 16, 2022 11:40
@adamziel adamziel self-assigned this Aug 16, 2022
@adamziel adamziel changed the title Remove useState from useEntityRecord usage examples [Docs] Replace useState with edit in useEntityRecord usage examples Aug 16, 2022
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the change for the example included as it promotes the API included with useEntityRecord. We need to ensure that useCallback will work correctly when the id changes that I have doubts about.

Co-authored-by: Greg Ziółkowski <[email protected]>
@gziolo
Copy link
Member

gziolo commented Aug 17, 2022

Static Analysis failed - the same changes need to be applied to JSDoc comment for useEntityRecord.

@adamziel adamziel merged commit 95d1ea3 into trunk Aug 17, 2022
@adamziel adamziel deleted the docs/useEntityRecord branch August 17, 2022 12:06
@github-actions github-actions bot added this to the Gutenberg 14.0 milestone Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Developer Experience Ideas about improving block and theme developer experience [Package] Core data /packages/core-data [Type] Developer Documentation Documentation for developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants