Skip to content

Commit 362fdde

Browse files
committed
fix: preserve flowName
1 parent 3389a71 commit 362fdde

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/frontend/src/pages/Flows/components/CreateFlowModal.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function FlowNameAndModeContent({
4343
isButtonDisabled,
4444
inputRef,
4545
loading,
46+
flowName,
4647
handleInputChange,
4748
handleSubmit,
4849
setCreateMode,
@@ -52,6 +53,7 @@ function FlowNameAndModeContent({
5253
isButtonDisabled: boolean
5354
loading: boolean
5455
inputRef: React.RefObject<HTMLInputElement>
56+
flowName: string
5557
handleInputChange: () => void
5658
handleSubmit: (event: FormEvent<HTMLFormElement>) => void
5759
setCreateMode: (mode: FLOW_CREATE_MODE) => void
@@ -71,6 +73,7 @@ function FlowNameAndModeContent({
7173
ref={inputRef}
7274
placeholder="For e.g. track event feedback, send customised replies"
7375
onChange={handleInputChange}
76+
value={flowName}
7477
required
7578
/>
7679
</FormControl>
@@ -142,6 +145,7 @@ export default function CreateFlowModal(props: CreateFlowModalProps) {
142145
// to minimise the re-renders to the max, didn't use react hook form cus overkill
143146
const handleInputChange = () => {
144147
const trimmedInputValue = inputRef.current?.value.trim() || ''
148+
setFlowName(trimmedInputValue)
145149
if (trimmedInputValue !== '') {
146150
if (isButtonDisabled) {
147151
setIsButtonDisabled(false)
@@ -232,6 +236,7 @@ export default function CreateFlowModal(props: CreateFlowModalProps) {
232236
isButtonDisabled={isButtonDisabled}
233237
loading={loading}
234238
inputRef={inputRef}
239+
flowName={flowName}
235240
handleInputChange={handleInputChange}
236241
handleSubmit={handleSubmit}
237242
setCreateMode={setCreateMode}

0 commit comments

Comments
 (0)