mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 01:20:24 +03:00
Merge pull request #777 from acelaya-forks/feature/fix-visits-filters
Fixed bots filter getting reset when changing date
This commit is contained in:
commit
51283cc130
2 changed files with 8 additions and 9 deletions
|
@ -87,13 +87,11 @@ export const VisitsStats: FC<VisitsStatsProps> = ({
|
|||
() => processStatsFromVisits(normalizedVisits),
|
||||
[normalizedVisits],
|
||||
);
|
||||
const resolvedFilter = useMemo(() => ({
|
||||
...visitsFilter,
|
||||
excludeBots: visitsFilter.excludeBots ?? settings.visits?.excludeBots,
|
||||
}), [visitsFilter]);
|
||||
const mapLocations = values(citiesForMap);
|
||||
const resolvedFilter = useMemo(() => (
|
||||
!isFirstLoad.current ? visitsFilter : {
|
||||
...visitsFilter,
|
||||
excludeBots: visitsFilter.excludeBots ?? settings.visits?.excludeBots,
|
||||
}
|
||||
), [visitsFilter]);
|
||||
|
||||
const setSelectedVisits = (selectedVisits: NormalizedVisit[]) => {
|
||||
selectedBar = undefined;
|
||||
|
|
|
@ -6,7 +6,7 @@ import { DateRange, datesToDateRange } from '../../utils/helpers/dateIntervals';
|
|||
import { OrphanVisitType, VisitsFilter } from '../types';
|
||||
import { parseQuery, stringifyQuery } from '../../utils/helpers/query';
|
||||
import { formatIsoDate } from '../../utils/helpers/date';
|
||||
import { BooleanString } from '../../utils/utils';
|
||||
import { BooleanString, parseBooleanToString } from '../../utils/utils';
|
||||
|
||||
interface VisitsQuery {
|
||||
startDate?: string;
|
||||
|
@ -47,11 +47,12 @@ export const useVisitsQuery = (): [VisitsFiltering, UpdateFiltering] => {
|
|||
);
|
||||
const updateFiltering = (extra: DeepPartial<VisitsFiltering>) => {
|
||||
const { dateRange, visitsFilter } = mergeDeepRight(filtering, extra);
|
||||
const { excludeBots, orphanVisitsType } = visitsFilter;
|
||||
const query: VisitsQuery = {
|
||||
startDate: (dateRange?.startDate && formatIsoDate(dateRange.startDate)) || '',
|
||||
endDate: (dateRange?.endDate && formatIsoDate(dateRange.endDate)) || '',
|
||||
excludeBots: visitsFilter.excludeBots ? 'true' : 'false',
|
||||
orphanVisitsType: visitsFilter.orphanVisitsType,
|
||||
excludeBots: excludeBots === undefined ? undefined : parseBooleanToString(excludeBots),
|
||||
orphanVisitsType,
|
||||
domain: theDomain,
|
||||
};
|
||||
const stringifiedQuery = stringifyQuery(query);
|
||||
|
|
Loading…
Reference in a new issue