From c90e6a3271596a08f3bf06b8337fd621526838a9 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Fri, 19 Apr 2024 15:06:20 +0700 Subject: [PATCH] chore(web): revert ineffective attempt to optimize prop-name looping --- .../web/keyboard-processor/src/keyboards/activeLayout.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/web/keyboard-processor/src/keyboards/activeLayout.ts b/common/web/keyboard-processor/src/keyboards/activeLayout.ts index c39925ff748..89156f8d9b8 100644 --- a/common/web/keyboard-processor/src/keyboards/activeLayout.ts +++ b/common/web/keyboard-processor/src/keyboards/activeLayout.ts @@ -57,8 +57,6 @@ const KeyTypesOfKeyMap = { default: 'boolean' } as const; -const KeySpecKeys = Object.keys(KeyTypesOfKeyMap) as (keyof typeof KeyTypesOfKeyMap)[]; - // Keep in this specific order: it's the ordering of priority for default hint selection when // based on available hints. (i.e., `layout.defaultHint == 'flick'`) const KeyTypesOfFlickList = ['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'] as const; @@ -288,7 +286,7 @@ export class ActiveKeyBase { // is NOT available within the Android app in extremely early APIs. // Object.entries requires Android 54. - for(const key of KeySpecKeys) { + for(const key of Object.keys(KeyTypesOfKeyMap)) { const value = KeyTypesOfKeyMap[key as keyof typeof KeyTypesOfKeyMap]; switch(value) { case 'subkeys': @@ -310,7 +308,9 @@ export class ActiveKeyBase { break; case 'flicks': const flickObj = rawKey[key]; - if(typeof flickObj != 'object') { + if(flickObj === undefined) { + break; + } else if(typeof flickObj != 'object') { delete rawKey[key]; } else { for(const flickKey of KeyTypesOfFlickList) {