From 883ab447d1573a868ef2b8d616628fd762afe289 Mon Sep 17 00:00:00 2001 From: Jamey Huffnagle Date: Wed, 31 Jul 2024 13:29:32 -0400 Subject: [PATCH 1/2] fix(app): fix CommandText console warnings Explictly handle a null command to prevent warnings. --- .../molecules/Command/hooks/useCommandTextString/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/molecules/Command/hooks/useCommandTextString/index.tsx b/app/src/molecules/Command/hooks/useCommandTextString/index.tsx index 34df2f33c7f..aff19e8a513 100644 --- a/app/src/molecules/Command/hooks/useCommandTextString/index.tsx +++ b/app/src/molecules/Command/hooks/useCommandTextString/index.tsx @@ -32,7 +32,11 @@ export function useCommandTextString( const fullParams = { ...params, t } - switch (command?.commandType) { + if (command == null) { + return { commandText: '' } + } + + switch (command.commandType) { case 'touchTip': case 'home': case 'savePosition': From 5bcb383b3327424319eceb199c347e068a51c9fa Mon Sep 17 00:00:00 2001 From: Jamey Huffnagle Date: Wed, 31 Jul 2024 13:46:40 -0400 Subject: [PATCH 2/2] eh, I like this way better --- .../molecules/Command/hooks/useCommandTextString/index.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/molecules/Command/hooks/useCommandTextString/index.tsx b/app/src/molecules/Command/hooks/useCommandTextString/index.tsx index aff19e8a513..093593dc911 100644 --- a/app/src/molecules/Command/hooks/useCommandTextString/index.tsx +++ b/app/src/molecules/Command/hooks/useCommandTextString/index.tsx @@ -32,11 +32,7 @@ export function useCommandTextString( const fullParams = { ...params, t } - if (command == null) { - return { commandText: '' } - } - - switch (command.commandType) { + switch (command?.commandType) { case 'touchTip': case 'home': case 'savePosition': @@ -220,6 +216,7 @@ export function useCommandTextString( commandText: utils.getCustomCommandText({ ...fullParams, command }), } + case undefined: case null: return { commandText: '' }