Skip to content

Commit d5ff72d

Browse files
mrcthmskyledurand
andauthored
[Storybook] Fix stories containing Modal components (#10492)
### WHY are these changes introduced? Due to a recent update to the Dialog component within the Modal, it now uses the `useFrame` hook. Due to this, we need to ensure that anywhere it's used, we have a parent `<Frame>` component anywhere. This is not an issue for production, where the `<Frame>` is automatically included by the `<AppProvider>` or for tests where `mountWithApp` includes the `<Frame>`, but I noticed some Storybook stories breaking. So we wrap all stories in a `<FrameContext.Provider>` component now. ### 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) - Go to Storybook generated by Chromatic - Go to the Banner -> In a Modal story - It should work fine - Go to the IndexFilters stories - Launch the Create new View modal - They should work fine - Go to the IndexTable stories that contain the filtering element - Launch the Create new View modal - They should work fine ### 🎩 checklist - [x] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [x] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [x] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [x] Updated the component's `README.md` with documentation changes - [x] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide --------- Co-authored-by: Kyle Durand <[email protected]>
1 parent a30fcc8 commit d5ff72d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changeset/six-donkeys-nail.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': patch
3+
---
4+
5+
Updated Storybook stories to be wrapped with an empty FrameContext.Provider

polaris-react/.storybook/preview.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {useRef, useEffect} from 'react';
22

3-
import {AppProvider} from '../src';
3+
import {AppProvider, FrameContext} from '../src';
44
import enTranslations from '../locales/en.json';
55
import {GridOverlay} from './GridOverlay';
66
import {RenderPerformanceProfiler} from './RenderPerformanceProfiler';
@@ -37,7 +37,9 @@ function AppProviderDecorator(Story, context) {
3737
}}
3838
i18n={enTranslations}
3939
>
40-
<Story {...context} />
40+
<FrameContext.Provider value={{}}>
41+
<Story {...context} />
42+
</FrameContext.Provider>
4143
</AppProvider>
4244
);
4345
}

0 commit comments

Comments
 (0)