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

DataViews documentation: add high-level graph explaining DataViews and data sources interaction #65457

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

oandregal
Copy link
Member

@oandregal oandregal commented Sep 18, 2024

What?

Adds a graph to the DataView's README explaining how DataViews works with data sources.

DataViews is data agnostic, it can work with data coming from a static (JSON file) or dynamic source (HTTP Request) — it just requires the data to be an array of objects that have a unique identifier. Consumers are responsible to query the data source appropriately based on the DataViews props:

2409-dataviews-flow

Why?

Through conversations, one consistent struggle people had was "how DataViews work with data?". People either assumes that DataViews is responsible to fetching data from an endpoint or that it can only work with static data. Far from the truth, DataViews can work with data coming from anywhere and it's important to clarify this.

How?

Expands the intro to DataViews component in the README and adds a graph explaining the data flow.

Copy link

github-actions bot commented Sep 18, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: oandregal <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: juanmaguitar <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@oandregal oandregal self-assigned this Sep 18, 2024
@oandregal oandregal added [Type] Developer Documentation Documentation for developers [Package] DataViews /packages/dataviews labels Sep 18, 2024
@@ -2,6 +2,10 @@

DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).

DataViews is data agnostic, it can work with data coming from a static (JSON file) or dynamic source (HTTP Request) — it just requires the data to be an array of objects that have an unique identifier. Consumers are responsible to query the data source appropiately based on the DataViews props:

![DataViews flow](dataviews-flow.png "DataViews flow")
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure this is the right way to embed images in the handbook. Do they still need to be in a external source (for example, pointing to the image as stored in this GitHub PR)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, I'm more than happy to collaborate and improve that graph: it's something I just created with the tools I had but other people may be able to create a better one.

Copy link
Contributor

Choose a reason for hiding this comment

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

For the existing image we have in the handbook, we use the full URL https://raw.githubusercontent.com/WordPress/gutenberg/HEAD/docs/explanations/architecture/assets/modules.png. Not sure why or if it's better though.

Also, we do keep the "source" modules.excalidraw file in the repo to be able to edit it in the future if needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, we do keep the "source" modules.excalidraw file in the repo to be able to edit it in the future if needed.

I can explore redoing the graph using excalidraw. Happy if anyone else beats me to it (have a bit of an hectic week).

Copy link
Contributor

Choose a reason for hiding this comment

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

No need to redo it if you lost your source or did it with some other tool, it was just a suggestion based on what I did before :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I just used Obsidian Canvas and I have the source file that I can share. I'm just not sure how useful it'd be to anyone else? 😅 It seems excalidraw would be a more widely known format/app, and I agree having a source file to re-generate the image from is very useful.

Copy link
Contributor

@juanmaguitar juanmaguitar Sep 18, 2024

Choose a reason for hiding this comment

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

The best way to use images in the Handbook is to upload them to the Media Library for the Handbook's WordPress installation and reference it from that URL (see example)

Happy to help in uploading the required images to the Handbook's WP installation.

There are several excalidraw diagrams in the Block Editor docs. The original diagram link (where things can be modified) can be added to a Resources list at the end of the page, but that's not always needed (I don't think it's needed in this case)

Note: For accesibility issues the link to the image containing the diagram should also point to an image

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@oandregal if you change the link of the image to point to the URL above I think we can move forward with this PR.
I'm approving it to unlock the merge.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, pushed those changes (be welcome to push them yourself in the future!). In the interest of shipping small improvements regularly, I'm merging this one. Perhaps we need to revisit it to also include DataForm documentation here. At that point, I can try with excalidraw.

@oandregal oandregal enabled auto-merge (squash) September 20, 2024 20:53
@oandregal oandregal merged commit e691b04 into trunk Sep 20, 2024
61 checks passed
@oandregal oandregal deleted the update/dataviews-docs-flow branch September 20, 2024 21:27
@github-actions github-actions bot added this to the Gutenberg 19.4 milestone Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] DataViews /packages/dataviews [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants