@rspress/runtime 1.12.3 → 1.13.1
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/dist/hooks.js +2 -1
- package/package.json +4 -4
- package/src/hooks.ts +2 -1
package/dist/hooks.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
createContext,
|
3
|
+
useCallback,
|
3
4
|
useContext,
|
4
5
|
useLayoutEffect,
|
5
6
|
useState
|
@@ -26,7 +27,7 @@ function useDark() {
|
|
26
27
|
}
|
27
28
|
function useI18n() {
|
28
29
|
const lang = useLang();
|
29
|
-
return (key) => i18nTextData[key][lang];
|
30
|
+
return useCallback((key) => i18nTextData[key][lang], [lang]);
|
30
31
|
}
|
31
32
|
function useViewTransition(dom) {
|
32
33
|
const [element, setElement] = useState(dom);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspress/runtime",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.13.1",
|
4
4
|
"description": "The Runtime of Rspress Documentation Framework",
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
6
6
|
"repository": {
|
@@ -33,11 +33,11 @@
|
|
33
33
|
"react-dom": "^18.2.0",
|
34
34
|
"react-helmet-async": "^1.3.0",
|
35
35
|
"react-router-dom": "^6.8.1",
|
36
|
-
"@rspress/shared": "1.
|
36
|
+
"@rspress/shared": "1.13.1"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@modern-js/tsconfig": "2.
|
40
|
-
"@modern-js/types": "2.
|
39
|
+
"@modern-js/tsconfig": "2.48.0",
|
40
|
+
"@modern-js/types": "2.48.0",
|
41
41
|
"@types/jest": "^26.0.9",
|
42
42
|
"@types/react": "^18",
|
43
43
|
"@types/react-dom": "^18",
|
package/src/hooks.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import {
|
2
2
|
ReactElement,
|
3
3
|
createContext,
|
4
|
+
useCallback,
|
4
5
|
useContext,
|
5
6
|
useLayoutEffect,
|
6
7
|
useState,
|
@@ -52,7 +53,7 @@ export function useDark() {
|
|
52
53
|
export function useI18n<T = Record<string, Record<string, string>>>() {
|
53
54
|
const lang = useLang();
|
54
55
|
|
55
|
-
return (key: keyof T) => i18nTextData[key][lang];
|
56
|
+
return useCallback((key: keyof T) => i18nTextData[key][lang], [lang]);
|
56
57
|
}
|
57
58
|
|
58
59
|
declare global {
|