Merge branch 'urlfilter'

This commit is contained in:
Connor Cleveland
2023-10-29 01:27:54 -05:00

View File

@@ -18,18 +18,18 @@ export function useInitialTableState(tableId: string): TableState {
const savedSorters = hasHashProperty("sorters")
? getHashProperty("sorters")
: isLocalStorageAvailable
? localStorage.getItem(`${tableId}-sorters`)
: null;
? localStorage.getItem(`${tableId}-sorters`)
: null;
const savedFilters = hasHashProperty("filters")
? getHashProperty("filters")
: isLocalStorageAvailable
? localStorage.getItem(`${tableId}-filters`)
: null;
? localStorage.getItem(`${tableId}-filters`)
: null;
const savedPagination = hasHashProperty("pagination")
? getHashProperty("pagination")
: isLocalStorageAvailable
? localStorage.getItem(`${tableId}-pagination`)
: null;
? localStorage.getItem(`${tableId}-pagination`)
: null;
const savedShowColumns = isLocalStorageAvailable ? localStorage.getItem(`${tableId}-showColumns`) : null;
const sorters = savedSorters ? JSON.parse(savedSorters) : [{ field: "id", order: "asc" }];
@@ -59,7 +59,7 @@ export function useStoreInitialState(tableId: string, state: TableState) {
if (filters.length > 0) {
if (isLocalStorageAvailable) {
localStorage.setItem(`${tableId}-filters`, JSON.stringify(filters));
setURLHash("filters", JSON.stringify(state.filters));
setURLHash("filters", JSON.stringify(filters));
}
} else {
localStorage.removeItem(`${tableId}-filters`);