Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy Staging to Main branch (bugfix) #866

Merged
merged 4 commits into from
Aug 8, 2024
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
15 changes: 13 additions & 2 deletions src/components/Filters/DimensionFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,19 @@
});
};

const handleSelectionChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
const newMultiSelect: string[] = e.target.value.split(',');
const handleSelectionChange = (
selection: React.ChangeEvent<HTMLSelectElement> | string
) => {
let newMultiSelect: string[] = [];
if (typeof selection === 'string') {
newMultiSelect = selectedKeys.includes(selection)
? selectedKeys.filter((key) => key !== selection)
: [...selectedKeys, selection];
} else {
if (selection.target.value !== '') {
newMultiSelect = selection.target.value.split(',');
}
}
setSelectedKeys(newMultiSelect);
dispatch({
type: 'SET_DIMENSIONS',
Expand Down Expand Up @@ -124,7 +135,7 @@
/>
);
}
}, [selectedKeys, selectedPanelKeys]);

Check warning on line 138 in src/components/Filters/DimensionFilter.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useMemo has missing dependencies: 'display', 'handleSelectionChange', 'options', 'property', 'toggleDimension', 'toggleDimensionForPanel', and 'type'. Either include them or remove the dependency array

const filterDescription =
property === 'priority_level'
Expand Down
14 changes: 5 additions & 9 deletions src/components/Filters/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,21 @@

type MultiSelectProps = {
display: string;
options: any[];

Check warning on line 14 in src/components/Filters/MultiSelect.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
selectedKeys: string[];
toggleDimension: (dimension: string) => void;
handleSelectionChange: (e: React.ChangeEvent<HTMLSelectElement>) => void;
handleSelectionChange: (
selection: React.ChangeEvent<HTMLSelectElement> | string
) => void;
};

const MultiSelect: FC<MultiSelectProps> = ({
display,
options,
selectedKeys,
toggleDimension,

Check warning on line 26 in src/components/Filters/MultiSelect.tsx

View workflow job for this annotation

GitHub Actions / lint

'toggleDimension' is defined but never used
handleSelectionChange,
}) => {
const multiSelectOptions = options.filter((option) => {
if (!selectedKeys.includes(option)) {
return option;
}
});

return (
<div className="space-x-2 min-h-[33.5px]">
<SelectFilter
Expand All @@ -51,7 +47,7 @@
key={index}
classNames={{ base: 'multiSelectChip' }}
endContent={<X aria-label={`close ${option}`} />}
onClose={() => toggleDimension(option)}
onClose={() => handleSelectionChange(option)}
>
{option}
</SelectFilterChip>
Expand All @@ -61,7 +57,7 @@
}}
onChange={handleSelectionChange}
>
{multiSelectOptions.map((option) => (
{options.map((option) => (
<SelectFilterItem
key={option}
value={option}
Expand Down
Loading