mig-schema-table 3.0.89 → 3.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -52,7 +52,7 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, custo
|
|
|
52
52
|
const [thMenuConfig, setThMenuConfig] = React.useState();
|
|
53
53
|
const isDataFunction = data instanceof Function;
|
|
54
54
|
const [sourceData, setSourceData] = React.useState(isDataFunction ? undefined : data);
|
|
55
|
-
const [locationHash, setLocationHash] = React.useState(parseLocationHash(window.location.hash));
|
|
55
|
+
const [locationHash, setLocationHash] = React.useState(useFilterStateHash ? parseLocationHash(window.location.hash) : {});
|
|
56
56
|
const [searchQuery, setSearchQuery] = React.useState(locationHash.searchQuery || "");
|
|
57
57
|
const [columnFilterMap, setColumnFilterMap] = React.useState(locationHash.columnFilterMap || defaultColumnFilters);
|
|
58
58
|
const [isDirty, setIsDirty] = React.useState(false);
|
|
@@ -551,9 +551,13 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, custo
|
|
|
551
551
|
// prevent hash change for undefined vs empty string compare
|
|
552
552
|
(searchQuery || locationHash.searchQuery) &&
|
|
553
553
|
searchQuery !== locationHash.searchQuery) {
|
|
554
|
+
const currentLocationHref = window.location.href;
|
|
554
555
|
// use setTimeout() so any button clickhandler is still executed before the hash is changed
|
|
555
556
|
setTimeout(() => {
|
|
556
|
-
|
|
557
|
+
// Did we not move away? Apply search info to location.hash
|
|
558
|
+
if (currentLocationHref === window.location.href) {
|
|
559
|
+
window.location.hash = serializeLocationHash(Object.assign(Object.assign({}, locationHash), { searchQuery }));
|
|
560
|
+
}
|
|
557
561
|
// 1 is not enough?!
|
|
558
562
|
}, 400);
|
|
559
563
|
}
|