fix bug when removed filter do not update
This commit is contained in:
1 parent
68fdc1c147
commit
0651168823
2 files changed
+5
-8
No files matched your search
@@ -102,13 +102,7 @@ export function FilterEditForm({ websiteId, onChange, onClose }: FilterEditFormP
|
||||
<Button onPress={handleReset}>{t(labels.reset)}</Button>
|
||||
<Row alignItems="center" justifyContent="flex-end" gridColumn="span 2" gap>
|
||||
<Button onPress={onClose}>{t(labels.cancel)}</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
onPress={handleSave}
|
||||
isDisabled={
|
||||
currentFilters.filter(f => f.value).length === 0 && !currentSegment && !currentCohort
|
||||
}
|
||||
>
|
||||
<Button variant="primary" onPress={handleSave}>
|
||||
{t(labels.apply)}
|
||||
</Button>
|
||||
</Row>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Checkbox, Row } from '@umami/react-zen';
|
||||
import { useState } from 'react';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
import { useFilters, useMessages, useNavigation } from '@/components/hooks';
|
||||
import { ListFilter } from '@/components/icons';
|
||||
import { DialogButton } from '@/components/input/DialogButton';
|
||||
import { FilterEditForm } from '@/components/input/FilterEditForm';
|
||||
@@ -15,14 +15,17 @@ export function WebsiteFilterButton({
|
||||
}) {
|
||||
const { t, labels } = useMessages();
|
||||
const { updateParams, pathname, router, query } = useNavigation();
|
||||
const { filters: currentFilters } = useFilters();
|
||||
const [excludeBounce, setExcludeBounce] = useState(!!query.excludeBounce);
|
||||
const isOverview =
|
||||
/^\/teams\/[^/]+\/websites\/[^/]+$/.test(pathname) || /^\/share\/[^/]+$/.test(pathname);
|
||||
|
||||
const handleChange = ({ filters, segment, cohort, match }: any) => {
|
||||
const params = filtersArrayToObject(filters);
|
||||
const cleared = Object.fromEntries(currentFilters.map(f => [f.name, undefined]));
|
||||
|
||||
const url = updateParams({
|
||||
...cleared,
|
||||
...params,
|
||||
segment,
|
||||
cohort,
|
||||
|
||||
Reference in new issue
Block a user