Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Apr 10, 2022
1 parent be65eea commit ce9086f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 11.16.4

- fix type 'TFunctionResult' is not assignable to type 'ReactNode' on React 18 [1480](https://github.com/i18next/react-i18next/pull/1480)

### 11.16.3

- types: children fix for React v18 [1478](https://github.com/i18next/react-i18next/pull/1478)
Expand Down
18 changes: 17 additions & 1 deletion react-i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@
}
});
}
function hasLoadedNamespace(ns, i18n) {

function oldI18nextHasLoadedNamespace(ns, i18n) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

if (!i18n.languages || !i18n.languages.length) {
Expand All @@ -492,6 +493,21 @@
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
return false;
}

function hasLoadedNamespace(ns, i18n) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var isNewerI18next = i18n.options.ignoreJSONStructure !== undefined;

if (!isNewerI18next) {
return oldI18nextHasLoadedNamespace(ns, i18n, options);
}

return i18n.hasLoadedNamespace(ns, {
precheck: function precheck(i18nInstance, loadNotPending) {
if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
}
});
}
function getDisplayName(Component) {
return Component.displayName || Component.name || (typeof Component === 'string' && Component.length > 0 ? Component : 'Unknown');
}
Expand Down
Loading

0 comments on commit ce9086f

Please sign in to comment.