@arcblock/ux 2.1.46 → 2.1.47

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.
@@ -82,18 +82,20 @@ const create = () => {
82
82
  rest = _objectWithoutProperties(_ref, _excluded);
83
83
 
84
84
  const [currentLocale, setCurrentLocale] = (0, _react.useState)(getLocale(locale));
85
+
86
+ const changeLocale = newLocale => {
87
+ setCurrentLocale(newLocale);
88
+ setLocale(newLocale);
89
+ };
90
+
85
91
  (0, _react.useEffect)(() => {
86
92
  const tmpLocale = getLocale(locale);
87
93
 
88
94
  if (tmpLocale !== currentLocale) {
89
- setCurrentLocale(tmpLocale);
90
- setLocale(tmpLocale);
91
- }
92
- }, [currentLocale, locale]);
95
+ changeLocale(locale);
96
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
93
97
 
94
- const changeLocale = newLocale => {
95
- setCurrentLocale(newLocale);
96
- };
98
+ }, [locale]);
97
99
 
98
100
  const translate = (key, data) => {
99
101
  if (!translations[currentLocale] || !translations[currentLocale][key]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.1.46",
3
+ "version": "2.1.47",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -52,10 +52,10 @@
52
52
  "react": ">=18.1.0",
53
53
  "react-ga": "^2.7.0"
54
54
  },
55
- "gitHead": "cd765bb0fe364dd784fad471435d2ddef23fefa4",
55
+ "gitHead": "ec39f2bad16b784ed65cbf3f74bf7f32d137f4c3",
56
56
  "dependencies": {
57
- "@arcblock/icons": "^2.1.46",
58
- "@arcblock/react-hooks": "^2.1.46",
57
+ "@arcblock/icons": "^2.1.47",
58
+ "@arcblock/react-hooks": "^2.1.47",
59
59
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
60
60
  "@emotion/react": "^11.9.0",
61
61
  "@emotion/styled": "^11.8.1",
@@ -38,17 +38,18 @@ const create = () => {
38
38
  function LocaleProvider({ children, locale, translations, ...rest }) {
39
39
  const [currentLocale, setCurrentLocale] = useState(getLocale(locale));
40
40
 
41
+ const changeLocale = (newLocale) => {
42
+ setCurrentLocale(newLocale);
43
+ setLocale(newLocale);
44
+ };
45
+
41
46
  useEffect(() => {
42
47
  const tmpLocale = getLocale(locale);
43
48
  if (tmpLocale !== currentLocale) {
44
- setCurrentLocale(tmpLocale);
45
- setLocale(tmpLocale);
49
+ changeLocale(locale);
46
50
  }
47
- }, [currentLocale, locale]);
48
-
49
- const changeLocale = (newLocale) => {
50
- setCurrentLocale(newLocale);
51
- };
51
+ // eslint-disable-next-line react-hooks/exhaustive-deps
52
+ }, [locale]);
52
53
 
53
54
  const translate = (key, data) => {
54
55
  if (!translations[currentLocale] || !translations[currentLocale][key]) {