@melv1c/ui-kit 1.5.3 → 1.6.0

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/index.cjs CHANGED
@@ -4525,9 +4525,13 @@ function UIKitProvider({
4525
4525
  i18nConfig = { locale: "en" },
4526
4526
  loadingComponent = null
4527
4527
  }) {
4528
- const [isReady, setIsReady] = React9.useState(false);
4529
- const i18nRef = React9.useRef(!i18nConfig.instance ? i18n__default.default.createInstance() : null);
4530
- const instance = i18nConfig.instance || i18nRef.current;
4528
+ const [localInstance] = React9.useState(
4529
+ () => !i18nConfig.instance ? i18n__default.default.createInstance() : null
4530
+ );
4531
+ const instance = i18nConfig.instance || localInstance;
4532
+ const [isReady, setIsReady] = React9.useState(
4533
+ () => !(i18nConfig.locale && !instance.isInitialized)
4534
+ );
4531
4535
  React9.useEffect(() => {
4532
4536
  if (i18nConfig.locale && !instance.isInitialized) {
4533
4537
  instance.use(reactI18next.initReactI18next).init({
@@ -4541,8 +4545,6 @@ function UIKitProvider({
4541
4545
  }).then(() => {
4542
4546
  setIsReady(true);
4543
4547
  });
4544
- } else {
4545
- setIsReady(true);
4546
4548
  }
4547
4549
  }, [i18nConfig, instance]);
4548
4550
  React9.useEffect(() => {