1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-27 13:49:10 +02:00
This commit is contained in:
sjaanus 2025-07-03 07:21:24 +03:00
parent 82aa78f442
commit 64ed460f98
No known key found for this signature in database
GPG Key ID: 20E007C0248BA7FF

View File

@ -22,10 +22,10 @@ export const useEventLogFilters = (
const location = useLocation();
const [availableFilters, setAvailableFilters] = useState<IFilterItem[]>([]);
useEffect(() => {
const searchParams = new URLSearchParams(location.search);
const createRemovableFilterOptions = (paramNames: string[]) => {
const createRemovableFilterOptions = (
searchParams: URLSearchParams,
paramNames: string[],
) => {
return paramNames.reduce(
(acc, paramName) => {
const hasParam = searchParams.has(paramName);
@ -34,8 +34,7 @@ export const useEventLogFilters = (
acc[paramName] =
hasParam && paramValue
? (() => {
const parsed =
FilterItemParam.decode(paramValue);
const parsed = FilterItemParam.decode(paramValue);
return parsed
? [
{
@ -52,7 +51,10 @@ export const useEventLogFilters = (
);
};
const removableOptions = createRemovableFilterOptions([
useEffect(() => {
const searchParams = new URLSearchParams(location.search);
const removableOptions = createRemovableFilterOptions(searchParams, [
'id',
'groupId',
]);