Handle undefined in key translator.
parent
ade9103571
commit
6db916b46f
|
@ -206,13 +206,11 @@ export let botReducer = generateReducer<BotState>(initialState(), afterEach)
|
|||
const isDown = status.state === "down";
|
||||
if (isBotMqtt) { /** This is way too hard to maintain */
|
||||
if (isDown) {
|
||||
console.log("~STASHING~");
|
||||
stashStatus(s);
|
||||
s.hardware.informational_settings.sync_status = undefined;
|
||||
} else {
|
||||
const botMqtt = s.connectivity["bot.mqtt"];
|
||||
if (botMqtt && botMqtt.state === "down") { // Going from "down" to "up"
|
||||
console.log("~UNSTASHING~");
|
||||
s.hardware.informational_settings.sync_status = s.statusStash;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,10 @@ const eachEntry = (): KeyTranslationPair[] => {
|
|||
.map(key => ({ jsCaseKey: camelCase(key), ruby_case_key: key, value: key }));
|
||||
};
|
||||
|
||||
const transferKey = (x: KeyTranslationPair) =>
|
||||
localStorage.setItem(x.ruby_case_key, localStorage.getItem(x.jsCaseKey) || "");
|
||||
const transferKey = (x: KeyTranslationPair) => {
|
||||
const item = localStorage.getItem(x.jsCaseKey);
|
||||
item && localStorage.setItem(x.ruby_case_key, item);
|
||||
};
|
||||
|
||||
export const DONE_FLAG = "done";
|
||||
|
||||
|
|
Loading…
Reference in New Issue