Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f

- Migrated `DateSelector` to use hooks instead of withAppProvider ([#2193](https://github.com/Shopify/polaris-react/pull/2193))
- Migrated `Toast` to use hooks ([#2222](https://github.com/Shopify/polaris-react/pull/2222))
- Removed `link`, `theme` and `scrollLockManager` from the object returned by withAppProvider as nothing consumes them any more ([#2277](https://github.com/Shopify/polaris-react/pull/2277))

### Deprecations

Expand Down
2 changes: 1 addition & 1 deletion src/utilities/tests/with-app-provider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('withAppProvider', () => {
consoleSpy.mockRestore();
};
expect(fn).toThrow(
`No Theme was provided. Your application must be wrapped in an <AppProvider> component. See https://polaris.shopify.com/components/structure/app-provider for implementation instructions.`,
`No i18n was provided. Your application must be wrapped in an <AppProvider> component. See https://polaris.shopify.com/components/structure/app-provider for implementation instructions.`,
);
});
});
9 changes: 0 additions & 9 deletions src/utilities/with-app-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import React from 'react';
import hoistStatics from 'hoist-non-react-statics';
import {useI18n} from './i18n';
import {useLink} from './link';
import {useScrollLockManager} from './scroll-lock-manager';
import {useTheme} from './theme';
import {useStickyManager} from './sticky-manager';
import {useAppBridge} from './app-bridge';
import {useMediaQuery} from './media-query';

export interface WithAppProviderProps {
polaris: {
link: ReturnType<typeof useLink>;
theme: ReturnType<typeof useTheme>;
intl: ReturnType<typeof useI18n>;
scrollLockManager: ReturnType<typeof useScrollLockManager>;
stickyManager: ReturnType<typeof useStickyManager>;
appBridge: ReturnType<typeof useAppBridge>;
mediaQuery: ReturnType<typeof useMediaQuery>;
Expand All @@ -26,10 +20,7 @@ export function withAppProvider<OwnProps>() {
) {
const WithAppProvider: React.FunctionComponent<OwnProps> = (props) => {
const polaris: WithAppProviderProps['polaris'] = {
link: useLink(),
theme: useTheme(),
intl: useI18n(),
scrollLockManager: useScrollLockManager(),
stickyManager: useStickyManager(),
appBridge: useAppBridge(),
mediaQuery: useMediaQuery(),
Expand Down