Remove circular dependency, avoid adding 2 new ones
This commit is contained in:
@ -6,11 +6,13 @@ import { type InstanceProps, create } from 'react-modal-promise'
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { CreateNewVariable } from '@src/components/AvailableVarsHelpers'
|
||||
import { useCalculateKclExpression } from '@src/lib/useCalculateKclExpression'
|
||||
import type { Selections } from '@src/lib/selections'
|
||||
|
||||
type ModalResolve = { variableName: string }
|
||||
type ModalReject = boolean
|
||||
type SetVarNameModalProps = InstanceProps<ModalResolve, ModalReject> & {
|
||||
valueName: string
|
||||
selectionRanges: Selections
|
||||
}
|
||||
|
||||
export const createSetVarNameModal = create<
|
||||
@ -24,9 +26,14 @@ export const SetVarNameModal = ({
|
||||
onResolve,
|
||||
onReject,
|
||||
valueName,
|
||||
selectionRanges,
|
||||
}: SetVarNameModalProps) => {
|
||||
const { isNewVariableNameUnique, newVariableName, setNewVariableName } =
|
||||
useCalculateKclExpression({ value: '', initialVariableName: valueName })
|
||||
useCalculateKclExpression({
|
||||
value: '',
|
||||
initialVariableName: valueName,
|
||||
selectionRanges,
|
||||
})
|
||||
|
||||
return (
|
||||
<Transition appear show={isOpen} as={Fragment}>
|
||||
|
Reference in New Issue
Block a user