@tolgee/react 7.1.0 → 7.1.1

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.
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  CachePublicRecord,
3
+ encodeCacheKey,
3
4
  getTranslateProps,
4
5
  TolgeeInstance,
5
6
  TolgeeStaticData,
@@ -67,15 +68,15 @@ export function useTolgeeSSR(
67
68
  const requiredRecords = tolgeeInstance.getRequiredDescriptors(language);
68
69
  const providedRecords = tolgeeInstance.getAllRecords();
69
70
  const missingRecords = requiredRecords
70
- .map(({ namespace, language }) =>
71
- namespace ? `${namespace}:${language}` : language
72
- )
71
+ .map((descriptor) => encodeCacheKey(descriptor))
73
72
  .filter((key) => !providedRecords.find((r) => r?.cacheKey === key));
74
73
 
75
- // eslint-disable-next-line no-console
76
- console.warn(
77
- `Tolgee: Missing records in "staticData" for proper SSR functionality: ${missingRecords.map((key) => `"${key}"`).join(', ')}`
78
- );
74
+ if (missingRecords.length) {
75
+ // eslint-disable-next-line no-console
76
+ console.warn(
77
+ `Tolgee: Missing records in "staticData" for proper SSR functionality: ${missingRecords.map((key) => `"${key}"`).join(', ')}`
78
+ );
79
+ }
79
80
  }
80
81
  });
81
82