Skip to content

Commit

Permalink
rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
jamuhl committed Mar 26, 2021
1 parent e83da8a commit 1e1bf1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 11.8.12

- refactor: remove unneeded object [1286](https://github.com/i18next/react-i18next/pull/1286)

### 11.8.11

- typescript: Bug fixes [1284](https://github.com/i18next/react-i18next/pull/1284)
Expand Down
16 changes: 7 additions & 9 deletions react-i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -819,12 +819,10 @@
});

function getT() {
return {
t: i18n.getFixedT(null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0])
};
return i18n.getFixedT(null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0]);
}

var _useState = React.useState(getT()),
var _useState = React.useState(getT),
_useState2 = _slicedToArray(_useState, 2),
t = _useState2[0],
setT = _useState2[1];
Expand All @@ -837,12 +835,12 @@

if (!ready && !useSuspense) {
loadNamespaces(i18n, namespaces, function () {
if (isMounted.current) setT(getT());
if (isMounted.current) setT(getT);
});
}

function boundReset() {
if (isMounted.current) setT(getT());
if (isMounted.current) setT(getT);
}

if (bindI18n && i18n) i18n.on(bindI18n, boundReset);
Expand All @@ -860,13 +858,13 @@
var isInitial = React.useRef(true);
React.useEffect(function () {
if (isMounted.current && !isInitial.current) {
setT(getT());
setT(getT);
}

isInitial.current = false;
}, [i18n]);
var ret = [t.t, i18n, ready];
ret.t = t.t;
var ret = [t, i18n, ready];
ret.t = t;
ret.i18n = i18n;
ret.ready = ready;
if (ready) return ret;
Expand Down
Loading

0 comments on commit 1e1bf1c

Please sign in to comment.