MDL-68528 js: Normalise empty component to "core" for string
authorAndrew Nicols <andrew@nicols.co.uk>
Sun, 26 Apr 2020 07:57:32 +0000 (15:57 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 19 May 2020 03:37:55 +0000 (11:37 +0800)
lib/amd/build/str.min.js
lib/amd/build/str.min.js.map
lib/amd/src/str.js

index a644679..3f33a1b 100644 (file)
Binary files a/lib/amd/build/str.min.js and b/lib/amd/build/str.min.js differ
index 5e6250a..b54e114 100644 (file)
Binary files a/lib/amd/build/str.min.js.map and b/lib/amd/build/str.min.js.map differ
index 13312ab..9905ec9 100644 (file)
@@ -59,7 +59,12 @@ export const get_strings = (requests) => {
     let requestData = [];
     const pageLang = $('html').attr('lang').replace(/-/g, '_');
     // Helper function to construct the cache key.
-    const getCacheKey = ({key, component, lang = pageLang}) => `core_str/${key}/${component}/${lang}`;
+    const getCacheKey = ({key, component, lang = pageLang}) => {
+        if (!component) {
+            component = 'core';
+        }
+        return `core_str/${key}/${component}/${lang}`;
+    };
 
     const stringPromises = requests.map((request) => {
         const cacheKey = getCacheKey(request);