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
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export function CompactSelect<Value extends SelectKey>({
// List props
options,
value,
defaultValue,
onChange,
onSectionToggle,
multiple,
Expand All @@ -87,7 +86,6 @@ export function CompactSelect<Value extends SelectKey>({
return {
multiple,
value,
defaultValue,
onChange,
closeOnSelect,
grid,
Expand All @@ -96,12 +94,11 @@ export function CompactSelect<Value extends SelectKey>({
return {
multiple,
value,
defaultValue,
onChange,
closeOnSelect,
grid,
};
}, [multiple, value, defaultValue, onChange, closeOnSelect, grid]);
}, [multiple, value, onChange, closeOnSelect, grid]);

const itemsWithKey = useMemo(() => getItemsWithKeys(options), [options]);

Expand Down
8 changes: 4 additions & 4 deletions static/app/components/core/compactSelect/composite.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('CompactSelect', () => {
<CompositeSelect menuTitle="Menu title">
<CompositeSelect.Region
label="Region 1"
defaultValue="choice_one"
value="choice_one"
onChange={() => {}}
options={[
{value: 'choice_one', label: 'Choice One'},
Expand All @@ -18,7 +18,7 @@ describe('CompactSelect', () => {
<CompositeSelect.Region
multiple
label="Region 2"
defaultValue={['choice_three', 'choice_four']}
value={['choice_three', 'choice_four']}
onChange={() => {}}
options={[
{value: 'choice_three', label: 'Choice Three'},
Expand Down Expand Up @@ -252,7 +252,7 @@ describe('CompactSelect', () => {
<CompositeSelect grid>
<CompositeSelect.Region
label="Region 1"
defaultValue="choice_one"
value="choice_one"
onChange={() => {}}
options={[
{value: 'choice_one', label: 'Choice One'},
Expand Down Expand Up @@ -317,7 +317,7 @@ describe('CompactSelect', () => {
<CompositeSelect>
<CompositeSelect.Region
label="Region 1"
defaultValue={1}
value={1}
onChange={onChange}
options={[
{value: 1, label: 'One'},
Expand Down
5 changes: 1 addition & 4 deletions static/app/components/core/compactSelect/composite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ type RegionProps<Value extends SelectKey> = CompositeSelectRegion<Value> & {
function Region<Value extends SelectKey>({
options,
value,
defaultValue,
onChange,
multiple,
disallowEmptySelection,
Expand All @@ -151,19 +150,17 @@ function Region<Value extends SelectKey>({
return {
multiple,
value,
defaultValue,
closeOnSelect,
onChange,
};
}
return {
multiple,
value,
defaultValue,
closeOnSelect,
onChange,
};
}, [multiple, value, defaultValue, onChange, closeOnSelect]);
}, [multiple, value, onChange, closeOnSelect]);

const itemsWithKey = useMemo(() => getItemsWithKeys(options), [options]);

Expand Down
9 changes: 5 additions & 4 deletions static/app/components/core/compactSelect/control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ export interface ControlProps
extends Omit<
React.BaseHTMLAttributes<HTMLDivElement>,
// omit keys from SingleListProps because those will be passed to <List /> instead
keyof Omit<
SingleListProps<SelectKey>,
'children' | 'items' | 'grid' | 'compositeIndex' | 'label'
>
| keyof Omit<
SingleListProps<SelectKey>,
'children' | 'items' | 'grid' | 'compositeIndex' | 'label'
>
| 'defaultValue'
>,
Pick<
UseOverlayProps,
Expand Down
8 changes: 0 additions & 8 deletions static/app/components/core/compactSelect/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ export interface SingleListProps<Value extends SelectKey> extends BaseListProps<
* that receives the newly selected option and returns whether to close the menu.
*/
closeOnSelect?: boolean | ((selectedOption: SelectOption<Value>) => boolean);
defaultValue?: Value;
multiple?: false;
onChange?: (selectedOption: SelectOption<Value>) => void;
value?: Value;
Expand All @@ -118,7 +117,6 @@ export interface MultipleListProps<Value extends SelectKey> extends BaseListProp
* that receives the newly selected options and returns whether to close the menu.
*/
closeOnSelect?: boolean | ((selectedOptions: Array<SelectOption<Value>>) => boolean);
defaultValue?: Value[];
onChange?: (selectedOptions: Array<SelectOption<Value>>) => void;
value?: Value[];
}
Expand All @@ -133,7 +131,6 @@ export interface MultipleListProps<Value extends SelectKey> extends BaseListProp
function List<Value extends SelectKey>({
items,
value,
defaultValue,
onChange,
grid,
multiple,
Expand Down Expand Up @@ -170,7 +167,6 @@ function List<Value extends SelectKey>({
disabledKeys,
// react-aria turns all keys into strings
selectedKeys: value?.map(getEscapedKey),
defaultSelectedKeys: defaultValue?.map(getEscapedKey),
disallowEmptySelection,
allowDuplicateSelectionEvents: true,
onSelectionChange: selection => {
Expand All @@ -196,9 +192,6 @@ function List<Value extends SelectKey>({
disabledKeys,
// react-aria turns all keys into strings
selectedKeys: defined(value) ? [getEscapedKey(value)] : undefined,
defaultSelectedKeys: defined(defaultValue)
? [getEscapedKey(defaultValue)]
: undefined,
disallowEmptySelection: disallowEmptySelection ?? true,
allowDuplicateSelectionEvents: true,
onSelectionChange: selection => {
Expand All @@ -221,7 +214,6 @@ function List<Value extends SelectKey>({
};
}, [
value,
defaultValue,
onChange,
items,
isOptionDisabled,
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/views/subscriptionPage/usageLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function UsageLog({location, subscription}: Props) {
clearable
menuTitle={t('Subscription Actions')}
options={eventNameOptions}
defaultValue={selectedEventName}
value={selectedEventName}
onClear={() => handleEventFilter(null)}
onChange={option => {
handleEventFilter(option.value);
Expand Down
Loading