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

[Type] Developer Documentation - Fix removeAllNotices dispatch on the removeAllNotices doc section of @wordpress/notices #57436

Merged
merged 2 commits into from
Jan 24, 2024

Conversation

leomuniz
Copy link
Contributor

What?

This PR replaces the missed removeNotices from useDispatch( noticesStore )with the removeAllNotices on the removeAllNotices section of the Gutenberg Reference Guide of the @wordpress/notices package.

Why?

The Usage example of the removeAllNotices section has a bug that prevents the code from working properly. It dispatches the removeNotices from noticesStore but it tries to use the removeAllNotices() method when clicking on the buttons below.

It seems that this removeAllNotices section was copied from the removeNotices section, but it missed replacing all the occurrences of the removeNotices method.

How?

It just replaces the removeNotices with removeAllNotices on the removeAllNotices doc section.

Testing Instructions

Not relevant as it doesn't change any working code.
But if you want to test the provided example, you must copy the code and paste it into a new React component, then, import it to be used in a React page (e.g. a WordPress admin page).

Testing Instructions for Keyboard

Not relevant

Screenshots or screencast

image image
The Usage example of the `removeAllNotices` section has a bug that prevents the code from working properly.

The method dispatched from `noticesStore` is `removeNotices` instead of the `removeAllNotices` used to remove all the notices at once below in the code when clicking on the buttons.

This PR simply replaces the `removeNotices` with the correct version `removeAllNotices`.
@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Dec 28, 2023
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @leomuniz! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@t-hamano
Copy link
Contributor

Thanks for the PR!

I think this change is correct, but the content of this markdown file is auto-generated from SDoc. Therefore, you need to change the following parts:

* select( noticesStore ).getNotices()

Then run npm run docs:build. That way GitHub Actions will also pass.

@t-hamano t-hamano added the [Type] Developer Documentation Documentation for developers label Dec 29, 2023
@leomuniz
Copy link
Contributor Author

Thank you, @t-hamano

I didn't know this doc was auto-generated. I work on this change (I'll need to setup Gutenberg locally to do it) and update the issue asap.

Happy new year :)

@leomuniz
Copy link
Contributor Author

Hey, @t-hamano

I made the change and ran the docs:build script. As expected, it generated the same doc file content I had manually changed previously. Then, I pushed the changes to this branch. But it was not enough to make all the Github actions pass.

I've debugged these errors a little bit and they don't seem related to the change I've made. Even the JS unit tests failing are actually failing in other parts of the code. So I'm not sure how to proceed.

Do you have any suggestions?
Thank you

@t-hamano t-hamano self-requested a review January 24, 2024 02:53
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

LGTM!

I've debugged these errors a little bit and they don't seem related to the change I've made.

That's right, some GitHub Actions sometimes fail. All re-run GitHub Actions are ✅, so I would like to merge this PR.

Thank you for your contribution!

@t-hamano t-hamano merged commit 2171067 into WordPress:trunk Jan 24, 2024
55 checks passed
@github-actions github-actions bot added this to the Gutenberg 17.6 milestone Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Developer Documentation Documentation for developers
2 participants