Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [backport release-0.5] Persist filters in URL for applications table (#2033) #2038

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ import { normalizeRisk } from "@app/utils/type-utils";
import { checkAccess } from "@app/utils/rbac-utils";

// Hooks
import {
deserializeFilterUrlParams,
useLocalTableControls,
} from "@app/hooks/table-controls";
import { useLocalTableControls } from "@app/hooks/table-controls";

// Queries
import { getArchetypeById, getAssessmentsByItemId } from "@app/api/rest";
Expand Down Expand Up @@ -313,11 +310,6 @@ export const ApplicationsTable: React.FC = () => {
};

// ----- Table controls
const urlParams = new URLSearchParams(window.location.search);
const filters = urlParams.get("filters");

const deserializedFilterValues = deserializeFilterUrlParams({ filters });

const tableControls = useLocalTableControls({
tableName: "applications",
idProperty: "id",
Expand All @@ -338,7 +330,7 @@ export const ApplicationsTable: React.FC = () => {
isActiveItemEnabled: true,
persistTo: {
activeItem: "urlParams",
filter: "sessionStorage",
filter: "urlParams",
pagination: "sessionStorage",
sort: "sessionStorage",
},
Expand All @@ -348,7 +340,6 @@ export const ApplicationsTable: React.FC = () => {
initialColumns: {
name: { isIdentity: true },
},
initialFilterValues: deserializedFilterValues,
getSortValues: (app) => ({
name: app.name,
businessService: app.businessService?.name || "",
Expand Down
Loading