diff --git a/remix/app/Providers/ThingtimeProvider.tsx b/remix/app/Providers/ThingtimeProvider.tsx index 8f43f4d..9b39648 100644 --- a/remix/app/Providers/ThingtimeProvider.tsx +++ b/remix/app/Providers/ThingtimeProvider.tsx @@ -168,6 +168,11 @@ export const ThingtimeProvider = (props: any): JSX.Element => { (...args) => { const rawPath = args[0] const path = rawPath + + if (!path) { + return thingtime + } + // do we need to sanitise? // const path = sanitise(rawPath) console.log("Getting thingtime at path", path) diff --git a/remix/app/components/Commander/Commander.tsx b/remix/app/components/Commander/Commander.tsx index cf02e55..e3069a8 100644 --- a/remix/app/components/Commander/Commander.tsx +++ b/remix/app/components/Commander/Commander.tsx @@ -269,22 +269,18 @@ export const Commander = (props) => { if (commandIsAction) { // nothing + const prevVal = getThingtime(commandPath) + const parentPath = getParentPath(commandPath) || "thingtime" try { // first try to execute literal javscript const fn = `() => { return ${commandValue} }` const evalFn = eval(fn) const realVal = evalFn() - const prevVal = getThingtime(commandPath) - const parentPath = getParentPath(commandPath) // console.log("nik realVal", realVal) // console.log("nik prevVal", prevVal) // console.log("nik parentPath", parentPath) // console.log("nik commandPath", commandPath) setThingtime(commandPath, realVal) - if (!prevVal) { - setContextPath(parentPath) - setShowContext(true, "commandIsAction check") - } } catch (err) { console.log( "Caught error after trying to execute literal javascript", @@ -299,10 +295,6 @@ export const Commander = (props) => { const prevVal = getThingtime(commandPath) const parentPath = getParentPath(commandPath) setThingtime(commandPath, realVal) - if (!prevVal) { - setContextPath(parentPath) - setShowContext(true, "commandIsAction check") - } } catch { // something very bad went wrong console.log( @@ -311,7 +303,13 @@ export const Commander = (props) => { ) } } - } else if (commandContainsPath) { + if (!prevVal) { + setContextPath(commandPath) + setShowContext(true, "commandIsAction check") + } + } + // if (commandContainsPath) + else { // const prevValue = getThingtime(commandPath) // const newValue = setThingtime(commandPath, prevValue) @@ -392,54 +390,65 @@ export const Commander = (props) => { left={0} alignItems={["flex-start", "center"]} flexDirection="column" - overflowY="scroll" maxWidth="100%" height="auto" - maxHeight="90vh" marginTop={2} borderRadius="12px" marginX={1} > setHoveredSuggestion(null)} - paddingY={3} > - {suggestions?.map((suggestion, i) => { - return ( - selectSuggestion(i)} - onMouseEnter={() => setHoveredSuggestion(i)} - paddingX={4} - > - {suggestion} - - ) - })} - - - + setHoveredSuggestion(null)} + paddingY={3} + > + {suggestions?.map((suggestion, i) => { + return ( + selectSuggestion(i)} + onMouseEnter={() => setHoveredSuggestion(i)} + paddingX={4} + > + {suggestion} + + ) + })} + + + +