@@ -6,8 +6,9 @@ import {
|
||||
Switch,
|
||||
SwitchProps,
|
||||
} from '@chakra-ui/react'
|
||||
import React, { useState } from 'react'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { MoreInfoTooltip } from '../MoreInfoTooltip'
|
||||
import { isDefined } from '@typebot.io/lib'
|
||||
|
||||
export type SwitchWithLabelProps = {
|
||||
label: string
|
||||
@@ -32,6 +33,11 @@ export const SwitchWithLabel = ({
|
||||
if (onCheckChange) onCheckChange(!isChecked)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (isChecked === undefined && isDefined(initialValue))
|
||||
setIsChecked(initialValue)
|
||||
}, [initialValue, isChecked])
|
||||
|
||||
return (
|
||||
<FormControl as={HStack} justifyContent={justifyContent}>
|
||||
<FormLabel mb="0">
|
||||
|
||||
@@ -123,7 +123,7 @@ export const VariableSearchInput = ({
|
||||
if (!inputValue || inputValue === '') return
|
||||
const id = 'v' + createId()
|
||||
onSelectVariable({ id, name: inputValue })
|
||||
createVariable({ id, name: inputValue })
|
||||
createVariable({ id, name: inputValue, isSessionVariable: true })
|
||||
inputRef.current?.blur()
|
||||
onClose()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user