mirror of
https://github.com/cupcakearmy/svelte-i18n.git
synced 2024-11-16 09:59:58 +01:00
refactor: 💡 prevent null lookups from being cached
This commit is contained in:
parent
6573f51e9b
commit
a1dc268654
@ -8,6 +8,7 @@ import { getGenericLocaleFrom } from './utils'
|
||||
const lookupCache: Record<string, Record<string, string>> = {}
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user