Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code examples for actions/selectors in Data Module packages. #42125

Open
12 of 19 tasks
ryanwelcher opened this issue Jul 4, 2022 · 12 comments
Open
12 of 19 tasks

Add code examples for actions/selectors in Data Module packages. #42125

ryanwelcher opened this issue Jul 4, 2022 · 12 comments
Assignees
Labels
Developer Experience Ideas about improving block and theme developer experience [Package] Blocks /packages/blocks [Package] Data /packages/data [Package] Edit Post /packages/edit-post [Package] Editor /packages/editor [Package] Notices /packages/notices [Package] Viewport /packages/viewport [Type] Developer Documentation Documentation for developers [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.

Comments

@ryanwelcher
Copy link
Contributor

ryanwelcher commented Jul 4, 2022

What problem does this address?

Working with any of the data modules provided by WordPress can be very confusing. When looking at the Data Modules section in the handbook, there are almost no code examples for developers to use as reference.

I would love to see an example for each action or selector that is exposed for use.

Packages:

What is your proposed solution?

Add an @example tag to each docblock. This will be picked up by the documentation generator and added to the handbook.

@ryanwelcher ryanwelcher added [Type] Developer Documentation Documentation for developers [Package] Data /packages/data [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues. Developer Experience Ideas about improving block and theme developer experience labels Jul 4, 2022
@ryanwelcher
Copy link
Contributor Author

#42023 introduced one example and makes usage much clearer for getNotices

Notices_Data___Block_Editor_Handbook___WordPress_Developer_Resources

@skorasaurus
Copy link
Member

skorasaurus commented Jul 7, 2022

In case you weren't aware, some resources that you may want to draw off of, for core/data:

https://github.com/WordPress/gutenberg/blob/bd06705979ad63ace26d15de47144c253c3b0fc8/docs/getting-started/data.md
https://wordpress.stackexchange.com/questions/390985/how-do-i-access-site-and-block-editor-state-data-and-use-useselect-or-withs/390986#390986

@t-hamano
Copy link
Contributor

@ryanwelcher

I have added missing data module references by #42651.
Could you please add it to the task list as well?

  • block-directory
  • customize-widgets
  • edit-site
  • edit-widgets
  • preferences
  • reusable-blocks
  • rich-text

And I would love to help add code examples too 😊

@ryanwelcher
Copy link
Contributor Author

I have added missing data module references by #42651.
Could you please add it to the task list as well?

This is fantastic! Thanks for putting that together. I've updated the list.

@t-hamano
Copy link
Contributor

@ryanwelcher
I have created PR #42831 about core/keyboard-shortcuts.

@t-hamano
Copy link
Contributor

t-hamano commented Aug 3, 2022

I have created PR #42921 about core/viewport.

@t-hamano
Copy link
Contributor

t-hamano commented Sep 1, 2022

I noticed that of the references I added in #42651, the selector and actions in the reusable-blocks package are all experimental.
Should this package be excluded from the documentation?

@t-hamano
Copy link
Contributor

I noticed that the selector and actions in the annotations package are all experimental too.

@ryanwelcher
Copy link
Contributor Author

It probably makes sense to exclude packages that are fully experimental.

@ryanwelcher
Copy link
Contributor Author

Some package are not exporting their stores. To keep the DX consistent, I have created the following PRs to to export the store:

@ryanwelcher
Copy link
Contributor Author

@troychaplin you might be interested in this issue.

@troychaplin
Copy link
Contributor

troychaplin commented Jul 20, 2024

I have added a few examples in core/editor in #63768, need a label added

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] Blocks /packages/blocks [Package] Data /packages/data [Package] Edit Post /packages/edit-post [Package] Editor /packages/editor [Package] Notices /packages/notices [Package] Viewport /packages/viewport [Type] Developer Documentation Documentation for developers [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Projects
None yet
Development

No branches or pull requests

6 participants