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

Divider: migrate from reakit to @ariakit/react #55622

Merged
merged 6 commits into from Nov 6, 2023
Merged

Conversation

flootr
Copy link
Contributor

@flootr flootr commented Oct 25, 2023

What?

Migrate Divider from reakit to ariakit.

Why?

Part of #53278

As stated in the linked issue Reakit does not explicitly support React 18 (causing peer dependency warnings) and Reakit has already been succeeded by Ariakit, so it will not receive any more updates.

How?

In this case we switch out the Reakit for the Ariakit imports.

Testing Instructions

  • There shouldn't be any type errors
  • Components unit tests should pass
  • Verify the component still looks and works as expected (verify via Storybook)

@flootr flootr added [Type] Code Quality Issues or PRs that relate to code quality [Package] Components /packages/components labels Oct 25, 2023
@flootr flootr self-assigned this Oct 25, 2023
@flootr flootr changed the title Divider: refactor from reakit to @ariakit/react Divider: migrate from reakit to @ariakit/react Oct 25, 2023
@flootr flootr mentioned this pull request Oct 26, 2023
9 tasks
@flootr flootr added this to In progress (owned) ⏳ in WordPress Components via automation Oct 31, 2023
@flootr flootr marked this pull request as ready for review October 31, 2023 10:15
@@ -2,7 +2,7 @@
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
import type { SeparatorProps } from 'reakit';
import type { SeparatorProps } from '@ariakit/react';
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the SeparatorProps from ariakit include the as and render props, which we don't want to expose.

We can easily fix this by adding 'as' and 'render' to the list of omitted props on line 14, but it would be also interesting to know if there;s any particular reason why previously we were not picking up the as prop from SeparatorProps, and now we are.

Copy link
Contributor Author

@flootr flootr Nov 2, 2023

Choose a reason for hiding this comment

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

I applied your suggestions via 7d0b7ce – I'm a bit unsure about the rationale you mentioned.

Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies in case I wasn't clear. What I was trying to say is that I was curious to know the reason why previously, when using reakit types, the as prop was not being picked up from SeparatorProps. I guess the answer is simply because SeparatorProps did not include the as prop .

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

Screenshot 2023-11-03 at 21 54 32

Looking at Storybook, the last couple of changes that I'd like to propose are to:

  • disable controls for the wrapElement prop (ie. setting the control type to null)
  • remove the ref prop from the table (since we usually don't list refs as props)

Copy link

github-actions bot commented Nov 6, 2023

Flaky tests detected in 9dfeb1b.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6771508073
📝 Reported issues:

@ciampo ciampo merged commit e848ed2 into trunk Nov 6, 2023
50 checks passed
WordPress Components automation moved this from In progress (owned) ⏳ to Done 🎉 Nov 6, 2023
@ciampo ciampo deleted the feat/divider-ariakit branch November 6, 2023 16:19
@github-actions github-actions bot added this to the Gutenberg 17.1 milestone Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Code Quality Issues or PRs that relate to code quality
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants