Skip to content

Commit

Permalink
fix: better name for hermesfilters; listen for onReset for filters (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mapmeld authored Nov 10, 2022
1 parent bf0d2a8 commit 75969d3
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const HpParallelCoordinates: React.FC<Props> = ({
const [filteredTrialIdMap, setFilteredTrialIdMap] = useState<Record<number, boolean>>();
const [selectedRowKeys, setSelectedRowKeys] = useState<number[]>([]);
const [showCompareTrials, setShowCompareTrials] = useState(false);
const [hermesCreatedFeatures, setHermesCreatedFeatures] = useState<HermesInternalFilters>({});
const [hermesCreatedFilters, setHermesCreatedFilters] = useState<HermesInternalFilters>({});

const hyperparameters = useMemo(() => {
return fullHParams.reduce((acc, key) => {
Expand Down Expand Up @@ -121,7 +121,7 @@ const HpParallelCoordinates: React.FC<Props> = ({

// Figure out which trials are filtered out based on user filters.

Object.entries(hermesCreatedFeatures).forEach(([key, list]) => {
Object.entries(hermesCreatedFilters).forEach(([key, list]) => {
if (!chartData.data[key] || list.length === 0) return;

chartData.data[key].forEach((value, index) => {
Expand All @@ -143,7 +143,7 @@ const HpParallelCoordinates: React.FC<Props> = ({
});

setFilteredTrialIdMap(newFilteredTrialIdMap);
}, [chartData, hermesCreatedFeatures]);
}, [chartData, hermesCreatedFilters]);

useEffect(() => {
resetFilteredTrials();
Expand All @@ -155,9 +155,10 @@ const HpParallelCoordinates: React.FC<Props> = ({

const config: Hermes.RecursivePartial<Hermes.Config> = useMemo(
() => ({
filters: hermesCreatedFeatures,
filters: hermesCreatedFilters,
hooks: {
onFilterChange: setHermesCreatedFeatures,
onFilterChange: setHermesCreatedFilters,
onReset: () => setHermesCreatedFilters({}),
},
style: {
axes: { label: { placement: 'after' } },
Expand All @@ -171,7 +172,7 @@ const HpParallelCoordinates: React.FC<Props> = ({
padding: [4, 120, 4, 16],
},
}),
[colorScale, setHermesCreatedFeatures, hermesCreatedFeatures, selectedMetric],
[colorScale, setHermesCreatedFilters, hermesCreatedFilters, selectedMetric],
);

const dimensions = useMemo(() => {
Expand Down

0 comments on commit 75969d3

Please sign in to comment.