From 4c5dfbbb3ba5dfa4209aea9ab3ad93ee2f2ab467 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sun, 14 Feb 2021 17:22:53 +0100 Subject: [PATCH] Fixed fallback imports --- shared/js/settings.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/shared/js/settings.ts b/shared/js/settings.ts index 13615f9f..8b29bbb9 100644 --- a/shared/js/settings.ts +++ b/shared/js/settings.ts @@ -79,7 +79,6 @@ function resolveKey( resolver: (key: string) => string | undefined, defaultValue: DefaultType ) : ValueType | DefaultType { - let value = resolver(key.key); if(typeof value === "string") { return decodeValueFromString(value, key.valueType); @@ -92,17 +91,14 @@ function resolveKey( continue; } - if(!key.fallbackImports) { - break; + if(key.fallbackImports) { + const fallbackValueImporter = key.fallbackImports[fallback]; + if(fallbackValueImporter) { + return fallbackValueImporter(value); + } } - /* fallback key succeeded */ - const fallbackValueImporter = key.fallbackImports[fallback]; - if(fallbackValueImporter) { - return fallbackValueImporter(value); - } - - break; + return decodeValueFromString(value, key.valueType); } return defaultValue;