@etsoo/react 1.8.36 → 1.8.38
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.
|
@@ -9,7 +9,6 @@ const react_router_dom_1 = require("react-router-dom");
|
|
|
9
9
|
* @param storage Storage
|
|
10
10
|
*/
|
|
11
11
|
function useSearchParamsWithCache(cacheKey, storage) {
|
|
12
|
-
const [sp] = (0, react_router_dom_1.useSearchParams)();
|
|
13
12
|
const data = {};
|
|
14
13
|
if (cacheKey) {
|
|
15
14
|
storage ?? (storage = new shared_1.WindowStorage());
|
|
@@ -18,6 +17,9 @@ function useSearchParamsWithCache(cacheKey, storage) {
|
|
|
18
17
|
Object.assign(data, paras);
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
|
-
|
|
20
|
+
if ((0, react_router_dom_1.useInRouterContext)()) {
|
|
21
|
+
const [sp] = (0, react_router_dom_1.useSearchParams)();
|
|
22
|
+
Object.assign(data, Object.fromEntries(sp.entries()));
|
|
23
|
+
}
|
|
22
24
|
return data;
|
|
23
25
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { WindowStorage } from "@etsoo/shared";
|
|
2
|
-
import { useSearchParams } from "react-router-dom";
|
|
2
|
+
import { useInRouterContext, useSearchParams } from "react-router-dom";
|
|
3
3
|
/**
|
|
4
4
|
* Read search parameters with cache
|
|
5
5
|
* @param cacheKey Cache key
|
|
6
6
|
* @param storage Storage
|
|
7
7
|
*/
|
|
8
8
|
export function useSearchParamsWithCache(cacheKey, storage) {
|
|
9
|
-
const [sp] = useSearchParams();
|
|
10
9
|
const data = {};
|
|
11
10
|
if (cacheKey) {
|
|
12
11
|
storage ?? (storage = new WindowStorage());
|
|
@@ -15,6 +14,9 @@ export function useSearchParamsWithCache(cacheKey, storage) {
|
|
|
15
14
|
Object.assign(data, paras);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
|
-
|
|
17
|
+
if (useInRouterContext()) {
|
|
18
|
+
const [sp] = useSearchParams();
|
|
19
|
+
Object.assign(data, Object.fromEntries(sp.entries()));
|
|
20
|
+
}
|
|
19
21
|
return data;
|
|
20
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.38",
|
|
4
4
|
"description": "TypeScript ReactJs UI Independent Framework",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"@emotion/css": "^11.13.5",
|
|
41
41
|
"@emotion/react": "^11.13.5",
|
|
42
42
|
"@emotion/styled": "^11.13.5",
|
|
43
|
-
"@etsoo/appscript": "^1.6.
|
|
43
|
+
"@etsoo/appscript": "^1.6.22",
|
|
44
44
|
"@etsoo/notificationbase": "^1.1.60",
|
|
45
45
|
"@etsoo/shared": "^1.2.66",
|
|
46
46
|
"react": "^18.3.1",
|
|
47
47
|
"react-dom": "^18.3.1",
|
|
48
|
-
"react-router-dom": "^7.
|
|
48
|
+
"react-router-dom": "^7.5.0",
|
|
49
49
|
"react-window": "^1.8.11"
|
|
50
50
|
},
|
|
51
51
|
"overrides": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@types/react-window": "^1.8.8",
|
|
67
67
|
"@vitejs/plugin-react": "^4.3.4",
|
|
68
68
|
"jsdom": "^26.0.0",
|
|
69
|
-
"typescript": "^5.8.
|
|
69
|
+
"typescript": "^5.8.3",
|
|
70
70
|
"vitest": "^3.1.1"
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IStorage, WindowStorage } from "@etsoo/shared";
|
|
2
|
-
import { useSearchParams } from "react-router-dom";
|
|
2
|
+
import { useInRouterContext, useSearchParams } from "react-router-dom";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Read search parameters with cache
|
|
@@ -10,8 +10,6 @@ export function useSearchParamsWithCache(
|
|
|
10
10
|
cacheKey?: string,
|
|
11
11
|
storage?: IStorage
|
|
12
12
|
) {
|
|
13
|
-
const [sp] = useSearchParams();
|
|
14
|
-
|
|
15
13
|
const data = {};
|
|
16
14
|
|
|
17
15
|
if (cacheKey) {
|
|
@@ -22,7 +20,10 @@ export function useSearchParamsWithCache(
|
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
if (useInRouterContext()) {
|
|
24
|
+
const [sp] = useSearchParams();
|
|
25
|
+
Object.assign(data, Object.fromEntries(sp.entries()));
|
|
26
|
+
}
|
|
26
27
|
|
|
27
28
|
return data;
|
|
28
29
|
}
|