mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-30 23:34:27 +00:00
fix(ui): fix findings filter silent reverts by replacing useRelatedFilters effect with pure derivation (#10021)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
(cherry picked from commit 86946f3a84)
# Conflicts:
# ui/CHANGELOG.md
# ui/app/(prowler)/_overview/_components/accounts-selector.tsx
# ui/app/(prowler)/_overview/_components/provider-type-selector.tsx
# ui/components/filters/custom-checkbox-muted-findings.tsx
This commit is contained in:
1 parent
f15cf20b4f
commit
cd8e66efd2
6 files changed
+143
-203
No files matched your search
@@ -1,10 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
||||
import { useTransition } from "react";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
|
||||
import { Checkbox } from "@/components/shadcn";
|
||||
import { useFilterTransitionOptional } from "@/contexts";
|
||||
import { useUrlFilters } from "@/hooks/use-url-filters";
|
||||
|
||||
// Constants for muted filter URL values
|
||||
const MUTED_FILTER_VALUES = {
|
||||
@@ -13,18 +12,19 @@ const MUTED_FILTER_VALUES = {
|
||||
} as const;
|
||||
|
||||
export const CustomCheckboxMutedFindings = () => {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const searchParams = useSearchParams();
|
||||
<<<<<<< HEAD
|
||||
|
||||
// Use shared transition context if available, otherwise fall back to local
|
||||
const sharedTransition = useFilterTransitionOptional();
|
||||
const [, localStartTransition] = useTransition();
|
||||
const startTransition =
|
||||
sharedTransition?.startTransition ?? localStartTransition;
|
||||
=======
|
||||
const { navigateWithParams } = useUrlFilters();
|
||||
>>>>>>> 86946f3a8 (fix(ui): fix findings filter silent reverts by replacing useRelatedFilters effect with pure derivation (#10021))
|
||||
|
||||
// Get the current muted filter value from URL
|
||||
// Middleware ensures filter[muted] is always present when navigating to /findings
|
||||
const mutedFilterValue = searchParams.get("filter[muted]");
|
||||
|
||||
// URL states:
|
||||
@@ -34,8 +34,8 @@ export const CustomCheckboxMutedFindings = () => {
|
||||
|
||||
const handleMutedChange = (checked: boolean | "indeterminate") => {
|
||||
const isChecked = checked === true;
|
||||
const params = new URLSearchParams(searchParams.toString());
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (isChecked) {
|
||||
// Include muted: set special value (API will ignore invalid value and show all)
|
||||
params.set("filter[muted]", MUTED_FILTER_VALUES.INCLUDE);
|
||||
@@ -51,6 +51,16 @@ export const CustomCheckboxMutedFindings = () => {
|
||||
|
||||
startTransition(() => {
|
||||
router.push(`${pathname}?${params.toString()}`, { scroll: false });
|
||||
=======
|
||||
navigateWithParams((params) => {
|
||||
if (isChecked) {
|
||||
// Include muted: set special value (API will ignore invalid value and show all)
|
||||
params.set("filter[muted]", MUTED_FILTER_VALUES.INCLUDE);
|
||||
} else {
|
||||
// Exclude muted: apply filter to show only non-muted
|
||||
params.set("filter[muted]", MUTED_FILTER_VALUES.EXCLUDE);
|
||||
}
|
||||
>>>>>>> 86946f3a8 (fix(ui): fix findings filter silent reverts by replacing useRelatedFilters effect with pure derivation (#10021))
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user