Skip to content

Commit

Permalink
Merge pull request #48 from geekychandan/link-modal-bugfix
Browse files Browse the repository at this point in the history
fix: fix modal state reset
  • Loading branch information
deepakyadav-01 authored Oct 28, 2024
2 parents eb70b7f + 01864e2 commit f349217
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions component/src/components/ui/Dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ const FileUrlDialog = ({ isOpen, onClose, onSubmit, linkText, link, children })
const [text, setText] = useState(linkText || ""); // Initialize with title if provided
const [error, setError] = useState("");

// Reset dialog state after submission
useEffect(() => {
if (isOpen) {
resetToDefault();
}
}, [isOpen, link, linkText]);

const closeDialog = () => {
resetToDefault();
onClose();
Expand Down

0 comments on commit f349217

Please sign in to comment.