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 documentation for deprecating styles. #38540

Merged
merged 4 commits into from
Feb 10, 2022
Merged

Conversation

mirka
Copy link
Member

@mirka mirka commented Feb 4, 2022

Description

Add a "Deprecating styles" section to the wp-components contributors doc.

I mostly want to discuss and align on the style deprecation strategy here, not necessarily saying we have to include it in the devdocs. I thought through a bunch of options, and this is the strategy I am proposing. Thoughts?

Types of changes

Docs only.

@mirka mirka added [Type] Developer Documentation Documentation for developers [Package] Components /packages/components labels Feb 4, 2022
@mirka mirka requested a review from ciampo February 4, 2022 21:34
@mirka mirka requested a review from ajitbohra as a code owner February 4, 2022 21:34
@mirka mirka self-assigned this Feb 4, 2022
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.

Thank you @mirka for taking the initiative. This topic has already been informally discussed across a few PRs, and it's definitely a good idea to formalize a strategy.

cc @gziolo as in the past we've discussed deprecation strategies

packages/components/CONTRIBUTING.md Outdated Show resolved Hide resolved
@@ -180,6 +183,65 @@ All new component should be styled using [Emotion](https://emotion.sh/docs/intro

Note: Instead of using Emotion's standard `cx` function, the custom [`useCx` hook](/packages/components/src/utils/hooks/use-cx.ts) should be used instead.


### Deprecating styles
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this deprecation strategy be recommended also beyond styles? It seems like a reasonable strategy to use also for behavioural changes, API changes, etc...

Copy link
Member Author

@mirka mirka Feb 8, 2022

Choose a reason for hiding this comment

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

I do see this as a special case of deprecating APIs, where there is no actual prop to deprecate and it's just a change in default behavior. Looking at the instances in components/* where deprecated() is called, I'm not sure this kind of "change in default" deprecation has ever happened. Are you aware of any?

I did choose the __next* prefix so it would be appropriate for behavioral changes as well though, so it probably would be generally applicable when it happens. I think we could reuse or refactor this section when we write a more detailed deprecation guide for components.

By the way I just learned about this section that asks us to add a "Needs Dev Note" label to the PR. I'll add this into the doc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you aware of any?

On top of my mind, no. Hey @sarayourfriend (sorry for the ping!) — do you ever remember an instance of a deprecation where the meaning of a style/prop was changed (causing a potentially breaking change)?

I did choose the __next* prefix so it would be appropriate for behavioral changes as well though, so it probably would be generally applicable when it happens. I think we could reuse or refactor this section when we write a more detailed deprecation guide for components.

Sounds good to me. Having a defined way to "safely" introduce a breaking change is great and we should absolutely iterate on this procedure in order to be able to apply it to more deprecation scenarios

By the way I just learned about this section that asks us to add a "Needs Dev Note" label to the PR. I'll add this into the doc.

TIL !

Copy link
Contributor

Choose a reason for hiding this comment

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

do you ever remember an instance of a deprecation where the meaning of a style/prop was changed (causing a potentially breaking change)

I can't think of any from my time working on wp/components but that's mostly because I'm fairly certain we only "soft" deprecated things.

We did change the variant prop on the Text component, but it was experimental. We originally wrote an adapter for it IIRC but it isn't there anymore, or maybe it was never merged because the component was experimental anyway.

Although, does this count? #33490

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that's what I thought as well.

Although, does this count? #33490

Not sure if it does, I'd probably see it as more of a bug fix — isScrollable was implicitly introduced to CardBody in a previous PR, and the PR that you highlighted changes its default value to fix that regression.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right right... I feel like I remember seeing a bug raised where we'd accidentally left a deprecation or prop-meaning change out of the changelogs somewhere and it'd caused problems for someone consuming the package. Just can't remember how to find it now 😞

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the original "breaking change" was caused by my refactor of Card in #32566

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahhh yes! That is what I was remembering. But it was just an accidental prop value rename 😬 Doesn't really match what we're talking about here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good to know, thanks!

packages/components/CONTRIBUTING.md Show resolved Hide resolved
packages/components/CONTRIBUTING.md Show resolved Hide resolved
@mirka mirka merged commit c292c8b into trunk Feb 10, 2022
@mirka mirka deleted the docs/deprecating-styles branch February 10, 2022 17:32
@github-actions github-actions bot added this to the Gutenberg 12.7 milestone Feb 10, 2022
@cbravobernal cbravobernal changed the title Add docs for deprecating styles Add documentation for deprecating styles in style engine. Feb 26, 2022
@cbravobernal cbravobernal changed the title Add documentation for deprecating styles in style engine. Add documentation for deprecating styles. Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants