@trackunit/filters-filter-bar 1.8.88 → 1.8.89
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.
- package/index.cjs.js +4 -4
- package/index.esm.js +4 -4
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -2105,13 +2105,13 @@ const getPersistenceKey = (name, clientSideUserId) => `filter-${name}-${clientSi
|
|
|
2105
2105
|
*/
|
|
2106
2106
|
const useFilterBarPersistence = ({ name, setValue, refreshData, isDefaultValue, loadData: inputLoadData, saveData: inputSaveData, }) => {
|
|
2107
2107
|
const { clientSideUserId } = reactCoreHooks.useCurrentUser();
|
|
2108
|
-
const search = reactRouter.useSearch({ strict: false });
|
|
2108
|
+
const search = reactRouter.useSearch({ strict: false, shouldThrow: false });
|
|
2109
2109
|
const location = reactRouter.useLocation();
|
|
2110
2110
|
const navigate = reactRouter.useNavigate();
|
|
2111
2111
|
const { encode, decode } = reactCoreHooks.useCustomEncoding();
|
|
2112
2112
|
const { getUrlLengthWithSearchParam } = useSearchUtils();
|
|
2113
2113
|
const updateSearch = react.useCallback(async (searchParams) => {
|
|
2114
|
-
if (!inputLoadData && !inputSaveData) {
|
|
2114
|
+
if (!inputLoadData && !inputSaveData && Boolean(search)) {
|
|
2115
2115
|
// should check if the state has actually changed from what we last sent to the URL
|
|
2116
2116
|
if (!searchParams[name] ||
|
|
2117
2117
|
(typeof searchParams[name] === "string" &&
|
|
@@ -2155,7 +2155,7 @@ const useFilterBarPersistence = ({ name, setValue, refreshData, isDefaultValue,
|
|
|
2155
2155
|
react.useEffect(() => {
|
|
2156
2156
|
if (!inputLoadData && !inputSaveData) {
|
|
2157
2157
|
requestAnimationFrame(() => {
|
|
2158
|
-
const currentSearchValue = search[name];
|
|
2158
|
+
const currentSearchValue = search?.[name];
|
|
2159
2159
|
let currentSearchValueParsed;
|
|
2160
2160
|
let lastSearchUpdateRefParsed;
|
|
2161
2161
|
try {
|
|
@@ -2175,7 +2175,7 @@ const useFilterBarPersistence = ({ name, setValue, refreshData, isDefaultValue,
|
|
|
2175
2175
|
// H4sIADGRuGgAA3WTy07eQAxGXwVlXUtje27uruqWd0C2x1NaAa2AdoN49xq6-LOgUpQo0onny7H9ctzHsy591q8_73_dxXM8xNPT8fnl-KN3v-P4fHy5vj4-HQ96__5yd3e8fjqeQh_9Nt9v48fVfayr9f3b1YrHBH3f3GDBaj4Zui-HuvsADeO8KeFGrmYrj8hCbzTZrF0coRMRVEYHGcKAsW1Iw8qiF3ox06zbASth1t4GVsqCUvIxqO9R-EJ7w2aDJnjHCbV6JtmlgOSHQzB4DLvQtiwiRGB3aUk3h0lLgdyjFiyD8USPhd55BYzakkbaSbeA2jfmFaV7v9BMErKLguWpUNdQEKwTsqqXNETL_eRkbqojy1K0pCtVkK4LJM2VPtk6lQtdcIpSs2RGno9aQG0LSJrmvgrKHCeDFWWQN0iNNZMYgczFQNtH0VbqKifaq7uVBFdvBIgRIBoClcLXQFlC7VR7E7l2PdHKnH36kN5rJFY96Z0m3mhTKv-hG8cscytgU0vLnAOlTNAWdd_TR11y8m3dsxsGyJp_2XOg5hyZOxaP2Qu6nX137DbnW5L0_S-3p9CPk2hC09sG15SXgrKrHgQlpYe6ZKl9oScNb74IOmMmmbkSYmmHdYWZ7z3baWKpiWq0nA6u2fkEYFoOS-_OtibuIqfdaa0oDytgnB2saSC3YTSI0UKIc9nofWJf_wIRCrRd6AMAAA
|
|
2176
2176
|
// Check if this is an external URL change (not from our own updates)
|
|
2177
2177
|
// Only trigger refreshData if there's a meaningful change in the URL value
|
|
2178
|
-
if (search[name] !== undefined && !dequal.dequal(currentSearchValueParsed, lastSearchUpdateRefParsed)) {
|
|
2178
|
+
if (search?.[name] !== undefined && !dequal.dequal(currentSearchValueParsed, lastSearchUpdateRefParsed)) {
|
|
2179
2179
|
// This is an external URL change with actual data, trigger refreshData
|
|
2180
2180
|
if (refreshDataRef.current) {
|
|
2181
2181
|
refreshDataRef.current();
|
package/index.esm.js
CHANGED
|
@@ -2103,13 +2103,13 @@ const getPersistenceKey = (name, clientSideUserId) => `filter-${name}-${clientSi
|
|
|
2103
2103
|
*/
|
|
2104
2104
|
const useFilterBarPersistence = ({ name, setValue, refreshData, isDefaultValue, loadData: inputLoadData, saveData: inputSaveData, }) => {
|
|
2105
2105
|
const { clientSideUserId } = useCurrentUser();
|
|
2106
|
-
const search = useSearch({ strict: false });
|
|
2106
|
+
const search = useSearch({ strict: false, shouldThrow: false });
|
|
2107
2107
|
const location = useLocation();
|
|
2108
2108
|
const navigate = useNavigate();
|
|
2109
2109
|
const { encode, decode } = useCustomEncoding();
|
|
2110
2110
|
const { getUrlLengthWithSearchParam } = useSearchUtils();
|
|
2111
2111
|
const updateSearch = useCallback(async (searchParams) => {
|
|
2112
|
-
if (!inputLoadData && !inputSaveData) {
|
|
2112
|
+
if (!inputLoadData && !inputSaveData && Boolean(search)) {
|
|
2113
2113
|
// should check if the state has actually changed from what we last sent to the URL
|
|
2114
2114
|
if (!searchParams[name] ||
|
|
2115
2115
|
(typeof searchParams[name] === "string" &&
|
|
@@ -2153,7 +2153,7 @@ const useFilterBarPersistence = ({ name, setValue, refreshData, isDefaultValue,
|
|
|
2153
2153
|
useEffect(() => {
|
|
2154
2154
|
if (!inputLoadData && !inputSaveData) {
|
|
2155
2155
|
requestAnimationFrame(() => {
|
|
2156
|
-
const currentSearchValue = search[name];
|
|
2156
|
+
const currentSearchValue = search?.[name];
|
|
2157
2157
|
let currentSearchValueParsed;
|
|
2158
2158
|
let lastSearchUpdateRefParsed;
|
|
2159
2159
|
try {
|
|
@@ -2173,7 +2173,7 @@ const useFilterBarPersistence = ({ name, setValue, refreshData, isDefaultValue,
|
|
|
2173
2173
|
// H4sIADGRuGgAA3WTy07eQAxGXwVlXUtje27uruqWd0C2x1NaAa2AdoN49xq6-LOgUpQo0onny7H9ctzHsy591q8_73_dxXM8xNPT8fnl-KN3v-P4fHy5vj4-HQ96__5yd3e8fjqeQh_9Nt9v48fVfayr9f3b1YrHBH3f3GDBaj4Zui-HuvsADeO8KeFGrmYrj8hCbzTZrF0coRMRVEYHGcKAsW1Iw8qiF3ox06zbASth1t4GVsqCUvIxqO9R-EJ7w2aDJnjHCbV6JtmlgOSHQzB4DLvQtiwiRGB3aUk3h0lLgdyjFiyD8USPhd55BYzakkbaSbeA2jfmFaV7v9BMErKLguWpUNdQEKwTsqqXNETL_eRkbqojy1K0pCtVkK4LJM2VPtk6lQtdcIpSs2RGno9aQG0LSJrmvgrKHCeDFWWQN0iNNZMYgczFQNtH0VbqKifaq7uVBFdvBIgRIBoClcLXQFlC7VR7E7l2PdHKnH36kN5rJFY96Z0m3mhTKv-hG8cscytgU0vLnAOlTNAWdd_TR11y8m3dsxsGyJp_2XOg5hyZOxaP2Qu6nX137DbnW5L0_S-3p9CPk2hC09sG15SXgrKrHgQlpYe6ZKl9oScNb74IOmMmmbkSYmmHdYWZ7z3baWKpiWq0nA6u2fkEYFoOS-_OtibuIqfdaa0oDytgnB2saSC3YTSI0UKIc9nofWJf_wIRCrRd6AMAAA
|
|
2174
2174
|
// Check if this is an external URL change (not from our own updates)
|
|
2175
2175
|
// Only trigger refreshData if there's a meaningful change in the URL value
|
|
2176
|
-
if (search[name] !== undefined && !dequal(currentSearchValueParsed, lastSearchUpdateRefParsed)) {
|
|
2176
|
+
if (search?.[name] !== undefined && !dequal(currentSearchValueParsed, lastSearchUpdateRefParsed)) {
|
|
2177
2177
|
// This is an external URL change with actual data, trigger refreshData
|
|
2178
2178
|
if (refreshDataRef.current) {
|
|
2179
2179
|
refreshDataRef.current();
|