File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 11'use client'
22
3- import { useState } from 'react'
3+ import { useEffect , useState } from 'react'
44import { Button } from '@/components/ui/button'
55import {
66 Dialog ,
@@ -35,7 +35,11 @@ export function ConfirmationInputDialog({
3535 confirmButtonText,
3636} : ConfirmationInputDialogProps ) {
3737 const [ inputValue , setInputValue ] = useState ( '' )
38-
38+
39+ useEffect ( ( ) => {
40+ if ( ! isOpen ) setInputValue ( '' )
41+ } , [ isOpen ] )
42+
3943 const isConfirmationMatch = inputValue === confirmationText
4044
4145 const handleConfirm = ( ) => {
@@ -46,9 +50,6 @@ export function ConfirmationInputDialog({
4650
4751 const handleOpenChange = ( open : boolean ) => {
4852 onOpenChange ( open )
49- if ( ! open ) {
50- setInputValue ( '' )
51- }
5253 }
5354
5455 return (
@@ -93,4 +94,4 @@ export function ConfirmationInputDialog({
9394 </ DialogContent >
9495 </ Dialog >
9596 )
96- }
97+ }
You can’t perform that action at this time.
0 commit comments