Skip to content

Commit 5215a4d

Browse files
committedMar 8, 2021
rebuild
1 parent 13c95ce commit 5215a4d

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed
 

‎CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 11.8.9
2+
3+
- Fix allow to replace i18n in provider with useTranslation hook [1273](https://github.com/i18next/react-i18next/pull/1273)
4+
15
### 11.8.8
26

37
- typescript: Allow `TFuncKey` to be used without specifying the namespace, in the same way TFunction and useTranslation work [1262](https://github.com/i18next/react-i18next/pull/1262)

‎react-i18next.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,15 @@
856856
return i18n.store.off(e, boundReset);
857857
});
858858
};
859-
}, [namespaces.join()]);
859+
}, [i18n, namespaces.join()]);
860+
var isInitial = React.useRef(true);
861+
React.useEffect(function () {
862+
if (isMounted.current && !isInitial.current) {
863+
setT(getT());
864+
}
865+
866+
isInitial.current = false;
867+
}, [i18n]);
860868
var ret = [t.t, i18n, ready];
861869
ret.t = t.t;
862870
ret.i18n = i18n;

‎react-i18next.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/useTranslation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function useTranslation(ns, props = {}) {
7474
if (bindI18nStore && i18n)
7575
bindI18nStore.split(' ').forEach((e) => i18n.store.off(e, boundReset));
7676
};
77-
}, [namespaces.join()]); // re-run effect whenever list of namespaces changes
77+
}, [i18n, namespaces.join()]); // re-run effect whenever list of namespaces changes
7878

7979
// t is correctly initialized by useState hook. We only need to update it after i18n
8080
// instance was replaced (for example in the provider).

0 commit comments

Comments
 (0)
Please sign in to comment.