fix: improve slash command conditional (#10102)

This commit is contained in:
Favour Ohanekwu 2022-01-04 01:29:23 -08:00 committed by GitHub
parent b703ceb69f
commit 36629df853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,14 +1,19 @@
import { isString } from "lodash";
import { isDynamicValue } from "utils/DynamicBindingUtils";
export const showBindingPrompt = (
showEvaluatedValue: boolean,
inputValue: any,
isHinterOpen: boolean,
): boolean => {
const isDynamicInputValue = inputValue && isDynamicValue(inputValue);
const lastCharacterOfSlash =
inputValue && isString(inputValue) && inputValue.slice(-1);
return (
showEvaluatedValue &&
(!isString(inputValue) ||
(!inputValue && !isHinterOpen) ||
(!inputValue?.includes("{{") && !inputValue?.includes("/")))
(!isDynamicInputValue && lastCharacterOfSlash !== "/"))
);
};