From a1dc2686542e17856cffaef9e69c76574d6d5abf Mon Sep 17 00:00:00 2001 From: Christian Kaisermann Date: Wed, 20 Nov 2019 22:20:56 -0300 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20prevent=20null=20loo?= =?UTF-8?q?kups=20from=20being=20cached?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/includes/lookup.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client/includes/lookup.ts b/src/client/includes/lookup.ts index 47b1c5a..130ced2 100644 --- a/src/client/includes/lookup.ts +++ b/src/client/includes/lookup.ts @@ -8,6 +8,7 @@ import { getGenericLocaleFrom } from './utils' const lookupCache: Record> = {} const addToCache = (path: string, locale: string, message: string) => { + if (!message) return message if (!(locale in lookupCache)) lookupCache[locale] = {} if (!(path in lookupCache[locale])) lookupCache[locale][path] = message return message