Ver código fonte

fix: better feature config loading hopefully

Sv443 1 ano atrás
pai
commit
a398401f56
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      src/config.ts

+ 2 - 2
src/config.ts

@@ -32,7 +32,7 @@ export async function loadFeatureConf(): Promise<FeatureConfig> {
       return featuresCache = defConf;
     }
 
-    return Object.freeze(featureConf ? JSON.parse(featureConf) : {});
+    return featuresCache = Object.freeze(featureConf ? JSON.parse(featureConf) : defConf);
   }
   catch(err) {
     await setDefaultFeatConf();
@@ -48,7 +48,7 @@ export function saveFeatureConf(featureConf: FeatureConfig) {
   if(!featureConf || typeof featureConf != "object")
     throw new TypeError("Feature config not provided or invalid");
 
-  log("");
+  log("Saving new feature config:", featureConf);
   featuresCache = { ...featureConf };
   return GM.setValue("betterytm-config", JSON.stringify(featureConf));
 }