From 332a1af7d1e961e90a6be198b5b238d843dfad3d Mon Sep 17 00:00:00 2001 From: Jeremy Neal Date: Tue, 9 May 2023 14:26:29 -0400 Subject: [PATCH] Add back check for GroupContext in ActionList.Selection to fix issues introduced to github/github (#3267) * Add back check for groupContext in ActionList Selection component. * Update src/ActionList/Selection.tsx Co-authored-by: Josh Black * chore: run format * Linting. --------- Co-authored-by: Josh Black Co-authored-by: Josh Black --- src/ActionList/Selection.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ActionList/Selection.tsx b/src/ActionList/Selection.tsx index 78ed43c2a1..96ba447b2e 100644 --- a/src/ActionList/Selection.tsx +++ b/src/ActionList/Selection.tsx @@ -1,16 +1,18 @@ import React from 'react' import {CheckIcon} from '@primer/octicons-react' -import {ListContext, ActionListProps} from './List' +import {ListContext} from './List' import {ActionListItemProps} from './shared' import {LeadingVisualContainer} from './Visuals' +import {GroupContext} from './Group' type SelectionProps = Pick export const Selection: React.FC> = ({selected}) => { + const {selectionVariant: groupSelectionVariant} = React.useContext(GroupContext) const {selectionVariant: listSelectionVariant} = React.useContext(ListContext) /** selectionVariant in Group can override the selectionVariant in List root */ /** fallback to selectionVariant from container menu if any (ActionMenu, SelectPanel ) */ - const selectionVariant: ActionListProps['selectionVariant'] = listSelectionVariant + const selectionVariant = groupSelectionVariant ?? listSelectionVariant if (!selectionVariant) { // if selectionVariant is not set on List, but Item is selected