Skip to content

Commit a2646a5

Browse files
authored
🐛 Persist filters in URL for applications table (#2033)
Fix regression after: #1980 Resolves: https://issues.redhat.com/browse/MTA-1390 Initial filter values work best if the table is not persisting state between reloads (default strategy, component state). If the table uses session or local storage then any existing filter overwrites the default value. From the end user perspective the functionality works only on the first load with a clean browser (no previous state). Switching to URL filter persistence provides the same functionality and ensures we have only one source of filters. Reference-Url: #1698 Signed-off-by: Radoslaw Szwajkowski <rszwajko@redhat.com>
1 parent 04c244e commit a2646a5

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

client/src/app/pages/applications/applications-table/applications-table.tsx

+2-11
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ import { checkAccess } from "@app/utils/rbac-utils";
6363
import WarningTriangleIcon from "@patternfly/react-icons/dist/esm/icons/warning-triangle-icon";
6464

6565
// Hooks
66-
import {
67-
deserializeFilterUrlParams,
68-
useLocalTableControls,
69-
} from "@app/hooks/table-controls";
66+
import { useLocalTableControls } from "@app/hooks/table-controls";
7067

7168
// Queries
7269
import { getArchetypeById, getAssessmentsByItemId } from "@app/api/rest";
@@ -308,11 +305,6 @@ export const ApplicationsTable: React.FC = () => {
308305
};
309306

310307
// ----- Table controls
311-
const urlParams = new URLSearchParams(window.location.search);
312-
const filters = urlParams.get("filters");
313-
314-
const deserializedFilterValues = deserializeFilterUrlParams({ filters });
315-
316308
const tableControls = useLocalTableControls({
317309
tableName: "applications",
318310
idProperty: "id",
@@ -333,7 +325,7 @@ export const ApplicationsTable: React.FC = () => {
333325
isActiveItemEnabled: true,
334326
persistTo: {
335327
activeItem: "urlParams",
336-
filter: "sessionStorage",
328+
filter: "urlParams",
337329
pagination: "sessionStorage",
338330
sort: "sessionStorage",
339331
},
@@ -343,7 +335,6 @@ export const ApplicationsTable: React.FC = () => {
343335
initialColumns: {
344336
name: { isIdentity: true },
345337
},
346-
initialFilterValues: deserializedFilterValues,
347338
getSortValues: (app) => ({
348339
name: app.name,
349340
businessService: app.businessService?.name || "",

0 commit comments

Comments
 (0)