diff --git a/UNRELEASED-V4.md b/UNRELEASED-V4.md index 38310a0b..a6e508b1 100644 --- a/UNRELEASED-V4.md +++ b/UNRELEASED-V4.md @@ -35,6 +35,7 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f - Upgraded the `Autocomplete` component from legacy context API to use createContext ([#1403](https://github.com/Shopify/polaris-react/pull/1403)) - Removed testID warning in tests ([#1447](https://github.com/Shopify/polaris-react/pull/1447)) - Updated `ThemeProvider` to use the new context api ([#1396](https://github.com/Shopify/polaris-react/pull/1396)) +- Removed `withContext` from `ResourceList.Item` ([#1503](https://github.com/Shopify/polaris-react/pull/1503)) - Updated `AppProvider` to no longer use `componentWillReceiveProps`([#1255](https://github.com/Shopify/polaris-react/pull/1255)) - Removed `withContext` from `Scrollable.ScrollTo` and added a test to boost coverage ([#1499](https://github.com/Shopify/polaris-react/pull/1499)) - Removed `withContext` from `ResourceList.FilterControl` ([#1500](https://github.com/Shopify/polaris-react/pull/1500)) diff --git a/src/components/ResourceList/components/Item/Item.tsx b/src/components/ResourceList/components/Item/Item.tsx index 613c4c2b..738aa6ca 100644 --- a/src/components/ResourceList/components/Item/Item.tsx +++ b/src/components/ResourceList/components/Item/Item.tsx @@ -2,7 +2,6 @@ import React from 'react'; import {HorizontalDotsMinor} from '@shopify/polaris-icons'; import {classNames} from '@shopify/css-utilities'; import {createUniqueIDFactory} from '@shopify/javascript-utilities/other'; -import compose from '@shopify/react-compose'; import isEqual from 'lodash/isEqual'; import {DisableableAction, WithContextTypes} from '../../../../types'; import ActionList from '../../../ActionList'; @@ -16,7 +15,6 @@ import Button, {buttonsFrom} from '../../../Button'; import {withAppProvider, WithAppProviderProps} from '../../../AppProvider'; import {SELECT_ALL_ITEMS, SelectedItems} from '../../types'; -import withContext from '../../../WithContext'; import ResourceListContext, {ResourceListContextType} from '../../context'; import styles from './Item.scss'; @@ -69,7 +67,7 @@ export type CombinedProps = const getUniqueCheckboxID = createUniqueIDFactory('ResourceListItemCheckbox'); const getUniqueOverlayID = createUniqueIDFactory('ResourceListItemOverlay'); -export class Item extends React.Component { +export class BaseItem extends React.Component { static getDerivedStateFromProps(nextProps: CombinedProps, prevState: State) { const selected = isSelected(nextProps.id, nextProps.context.selectedItems); @@ -411,9 +409,12 @@ function isSelected(id: string, selectedItems?: SelectedItems) { ); } -export default compose( - withContext( - ResourceListContext.Consumer, - ), - withAppProvider(), -)(Item); +function Item(props: CombinedProps) { + return ( + + {(context) => } + + ); +} + +export default withAppProvider()(Item);