Skip to content

Conversation

@gwyneplaine
Copy link
Contributor

@gwyneplaine gwyneplaine commented May 17, 2023

WHY are these changes introduced?

Feature flag needed for rollout.
Resolves https://github.com/Shopify/polaris-summer-editions/issues/33
Resolves https://github.com/Shopify/polaris-summer-editions/issues/32

WHAT is this pull request doing?

  • Add documented feature flag to AppProvider FeaturesContext.
  • Add explicit type (for better DX).
  • Add storybook story for QA
  • Add addon-panel widget to storybook for toggling feature flag for stories.

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import React from 'react';
import {Page} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
    </Page>
  );
}

🎩 checklist

@@ -1,5 +1,6 @@
export interface FeaturesConfig {
[key: string]: boolean;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

explicit summer_editions boolean add to FeaturesConfig type for dx

return (
<PolarisTestProvider
i18n={translations}
features={{newDesignLanguage: true}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure why this is still here since this was something we removed in v6 (afaik from the docs)

@github-actions
Copy link
Contributor

github-actions bot commented May 17, 2023

size-limit report 📦

Path Size
polaris-react-cjs 242.91 KB (+0.01% 🔺)
polaris-react-esm 157.21 KB (+0.01% 🔺)
polaris-react-esnext 219.68 KB (+0.01% 🔺)
polaris-react-css 47.45 KB (0%)

@gwyneplaine gwyneplaine requested a review from alex-page May 17, 2023 04:53
@gwyneplaine
Copy link
Contributor Author

Notably @alex-page it appears the useFeature hook is not presently exposed as an export of @shopify/polaris.
This is probably fine for 90% of our usecases for summer editions, but will mean any non polaris components that need access to the flag value won't be able to do so. If this is fine, we'll leave it. If its not fine, we can export it in this PR.

'@shopify/polaris': patch
---

Add polaris_summer_editions_2023 feature flag to AppProvider context.
Copy link
Contributor

Choose a reason for hiding this comment

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

could we name this polarisSummerEditions2023 instead? if not eslint in Shopify/web gets mad (typescript-eslint/naming-convention)

Screenshot 2023-05-17 at 4 35 50 PM

Copy link
Member

@alex-page alex-page May 17, 2023

Choose a reason for hiding this comment

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

Yes. The underscore approach is for the beta flag or feature flag.

@sophschneider
Copy link
Contributor

@gwyneplaine It should be fine for consumers to control the feature flag via the AppProvider features prop, I don't think they would need the useFeature hook since they're the one providing the boolean!

gwyneplaine and others added 5 commits May 18, 2023 09:02
Co-authored-by: Sophie Schneider <sophie.schneider@shopify.com>
Co-authored-by: Sophie Schneider <sophie.schneider@shopify.com>
Co-authored-by: Sophie Schneider <sophie.schneider@shopify.com>
Co-authored-by: Sophie Schneider <sophie.schneider@shopify.com>
Co-authored-by: Sophie Schneider <sophie.schneider@shopify.com>
@gwyneplaine gwyneplaine requested a review from sophschneider May 17, 2023 23:10
Copy link
Contributor

@sophschneider sophschneider left a comment

Choose a reason for hiding this comment

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

thanks for updating!

@sophschneider
Copy link
Contributor

hmm I think the story is broken
Screenshot 2023-05-17 at 7 43 15 PM

@gwyneplaine
Copy link
Contributor Author

hmm I think the story is broken Screenshot 2023-05-17 at 7 43 15 PM

AppProvider story isn't wrapped in an AppProvider, which is why that global toggle doesn't work.
The point of that story is just a simple click test to make sure the feature flag is working 🎉

@gwyneplaine gwyneplaine merged commit 5d50fd7 into v11.x.x May 18, 2023
@gwyneplaine gwyneplaine deleted the clee/app-provider-feature-flag branch May 18, 2023 01:39
@sophschneider
Copy link
Contributor

Thanks!!

@sophschneider
Copy link
Contributor

Screenshot 2023-05-18 at 10 56 08 AM Screenshot 2023-05-18 at 10 57 07 AM

hmm it doesnt work in any other story either. I think the features destructuring in the AppProvider is overriding everything

sophschneider added a commit that referenced this pull request May 18, 2023
### WHY are these changes introduced?

Fix `feature` -> `features`
[typo](#9227) in the storybook
AppProviderDecorator so the toggle works on all stories. Also removed
the button toggle from the AppProvider summer editions story to avoid
confusion between two toggle mechanisms

### How to 🎩
Toggle feature in control panel

https://5d559397bae39100201eedc1-zlfuvdfzep.chromatic.com/?path=/story/all-components-appprovider--with-summer-editions-feature
sophschneider added a commit that referenced this pull request May 18, 2023
…9227)

<!--
  ☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
  - Start with a verb, for example: Add, Delete, Improve, Fix…
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

### WHY are these changes introduced?

Feature flag needed for rollout. 
Resolves Shopify/archive-polaris-backlog-2024#33
Resolves Shopify/archive-polaris-backlog-2024#32

<!--
  Context about the problem that’s being addressed.
-->

### WHAT is this pull request doing?

* Add documented feature flag to AppProvider FeaturesContext. 
* Add explicit type (for better DX). 
* Add storybook story for QA
* Add addon-panel widget to storybook for toggling feature flag for
stories.

### How to 🎩

🖥 [Local development
instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development)
🗒 [General tophatting
guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md)
📄 [Changelog
guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog)

<!--
  Give as much information as needed to experiment with the component
  in the playground.
-->

<details>
<summary>Copy-paste this code in
<code>playground/Playground.tsx</code>:</summary>

```jsx
import React from 'react';
import {Page} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
    </Page>
  );
}
```

</details>

### 🎩 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [ ] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide

---------

Co-authored-by: Sophie Schneider <sophie.schneider@shopify.com>
gwyneplaine added a commit that referenced this pull request May 24, 2023
…9227)

<!--
  ☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
  - Start with a verb, for example: Add, Delete, Improve, Fix…
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

### WHY are these changes introduced?

Feature flag needed for rollout. 
Resolves Shopify/archive-polaris-backlog-2024#33
Resolves Shopify/archive-polaris-backlog-2024#32

<!--
  Context about the problem that’s being addressed.
-->

### WHAT is this pull request doing?

* Add documented feature flag to AppProvider FeaturesContext. 
* Add explicit type (for better DX). 
* Add storybook story for QA
* Add addon-panel widget to storybook for toggling feature flag for
stories.

### How to 🎩

🖥 [Local development
instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development)
🗒 [General tophatting
guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md)
📄 [Changelog
guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog)

<!--
  Give as much information as needed to experiment with the component
  in the playground.
-->

<details>
<summary>Copy-paste this code in
<code>playground/Playground.tsx</code>:</summary>

```jsx
import React from 'react';
import {Page} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
    </Page>
  );
}
```

</details>

### 🎩 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [ ] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide

---------

Co-authored-by: Sophie Schneider <sophie.schneider@shopify.com>
gwyneplaine pushed a commit that referenced this pull request May 24, 2023
### WHY are these changes introduced?

Fix `feature` -> `features`
[typo](#9227) in the storybook
AppProviderDecorator so the toggle works on all stories. Also removed
the button toggle from the AppProvider summer editions story to avoid
confusion between two toggle mechanisms

### How to 🎩
Toggle feature in control panel

https://5d559397bae39100201eedc1-zlfuvdfzep.chromatic.com/?path=/story/all-components-appprovider--with-summer-editions-feature
sam-b-rose pushed a commit that referenced this pull request May 26, 2023
…9227)

<!--
  ☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
  - Start with a verb, for example: Add, Delete, Improve, Fix…
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

### WHY are these changes introduced?

Feature flag needed for rollout. 
Resolves Shopify/archive-polaris-backlog-2024#33
Resolves Shopify/archive-polaris-backlog-2024#32

<!--
  Context about the problem that’s being addressed.
-->

### WHAT is this pull request doing?

* Add documented feature flag to AppProvider FeaturesContext. 
* Add explicit type (for better DX). 
* Add storybook story for QA
* Add addon-panel widget to storybook for toggling feature flag for
stories.

### How to 🎩

🖥 [Local development
instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development)
🗒 [General tophatting
guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md)
📄 [Changelog
guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog)

<!--
  Give as much information as needed to experiment with the component
  in the playground.
-->

<details>
<summary>Copy-paste this code in
<code>playground/Playground.tsx</code>:</summary>

```jsx
import React from 'react';
import {Page} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
    </Page>
  );
}
```

</details>

### 🎩 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [ ] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide

---------

Co-authored-by: Sophie Schneider <sophie.schneider@shopify.com>
sam-b-rose pushed a commit that referenced this pull request May 26, 2023
### WHY are these changes introduced?

Fix `feature` -> `features`
[typo](#9227) in the storybook
AppProviderDecorator so the toggle works on all stories. Also removed
the button toggle from the AppProvider summer editions story to avoid
confusion between two toggle mechanisms

### How to 🎩
Toggle feature in control panel

https://5d559397bae39100201eedc1-zlfuvdfzep.chromatic.com/?path=/story/all-components-appprovider--with-summer-editions-feature
sophschneider added a commit that referenced this pull request Jun 1, 2023
…9227)

<!--
  ☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
  - Start with a verb, for example: Add, Delete, Improve, Fix…
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

### WHY are these changes introduced?

Feature flag needed for rollout. 
Resolves Shopify/archive-polaris-backlog-2024#33
Resolves Shopify/archive-polaris-backlog-2024#32

<!--
  Context about the problem that’s being addressed.
-->

### WHAT is this pull request doing?

* Add documented feature flag to AppProvider FeaturesContext. 
* Add explicit type (for better DX). 
* Add storybook story for QA
* Add addon-panel widget to storybook for toggling feature flag for
stories.

### How to 🎩

🖥 [Local development
instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development)
🗒 [General tophatting
guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md)
📄 [Changelog
guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog)

<!--
  Give as much information as needed to experiment with the component
  in the playground.
-->

<details>
<summary>Copy-paste this code in
<code>playground/Playground.tsx</code>:</summary>

```jsx
import React from 'react';
import {Page} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
    </Page>
  );
}
```

</details>

### 🎩 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [ ] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide

---------

Co-authored-by: Sophie Schneider <sophie.schneider@shopify.com>
sophschneider added a commit that referenced this pull request Jun 1, 2023
### WHY are these changes introduced?

Fix `feature` -> `features`
[typo](#9227) in the storybook
AppProviderDecorator so the toggle works on all stories. Also removed
the button toggle from the AppProvider summer editions story to avoid
confusion between two toggle mechanisms

### How to 🎩
Toggle feature in control panel

https://5d559397bae39100201eedc1-zlfuvdfzep.chromatic.com/?path=/story/all-components-appprovider--with-summer-editions-feature
sophschneider added a commit that referenced this pull request Jun 1, 2023
…9227)

<!--
  ☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
  - Start with a verb, for example: Add, Delete, Improve, Fix…
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

### WHY are these changes introduced?

Feature flag needed for rollout. 
Resolves Shopify/archive-polaris-backlog-2024#33
Resolves Shopify/archive-polaris-backlog-2024#32

<!--
  Context about the problem that’s being addressed.
-->

### WHAT is this pull request doing?

* Add documented feature flag to AppProvider FeaturesContext. 
* Add explicit type (for better DX). 
* Add storybook story for QA
* Add addon-panel widget to storybook for toggling feature flag for
stories.

### How to 🎩

🖥 [Local development
instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development)
🗒 [General tophatting
guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md)
📄 [Changelog
guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog)

<!--
  Give as much information as needed to experiment with the component
  in the playground.
-->

<details>
<summary>Copy-paste this code in
<code>playground/Playground.tsx</code>:</summary>

```jsx
import React from 'react';
import {Page} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
    </Page>
  );
}
```

</details>

### 🎩 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [ ] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide

---------

Co-authored-by: Sophie Schneider <sophie.schneider@shopify.com>
sophschneider added a commit that referenced this pull request Jun 1, 2023
### WHY are these changes introduced?

Fix `feature` -> `features`
[typo](#9227) in the storybook
AppProviderDecorator so the toggle works on all stories. Also removed
the button toggle from the AppProvider summer editions story to avoid
confusion between two toggle mechanisms

### How to 🎩
Toggle feature in control panel

https://5d559397bae39100201eedc1-zlfuvdfzep.chromatic.com/?path=/story/all-components-appprovider--with-summer-editions-feature
chloerice pushed a commit that referenced this pull request Jun 5, 2023
…9227)

<!--
  ☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
  - Start with a verb, for example: Add, Delete, Improve, Fix…
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

Feature flag needed for rollout.
Resolves Shopify/archive-polaris-backlog-2024#33
Resolves Shopify/archive-polaris-backlog-2024#32

<!--
  Context about the problem that’s being addressed.
-->

* Add documented feature flag to AppProvider FeaturesContext.
* Add explicit type (for better DX).
* Add storybook story for QA
* Add addon-panel widget to storybook for toggling feature flag for
stories.

🖥 [Local development
instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development)
🗒 [General tophatting
guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md)
📄 [Changelog
guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog)

<!--
  Give as much information as needed to experiment with the component
  in the playground.
-->

<details>
<summary>Copy-paste this code in
<code>playground/Playground.tsx</code>:</summary>

```jsx
import React from 'react';
import {Page} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
    </Page>
  );
}
```

</details>

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [ ] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide

---------

Co-authored-by: Sophie Schneider <sophie.schneider@shopify.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants