diff --git a/src/components/ModForm.tsx b/src/components/ModForm.tsx index 982fc75..8be5ba8 100644 --- a/src/components/ModForm.tsx +++ b/src/components/ModForm.tsx @@ -60,7 +60,7 @@ export const ModForm = ({ existingModData }: ModFormProps) => { const [isPublishing, setIsPublishing] = useState(false) const [gameOptions, setGameOptions] = useState([]) const [formState, setFormState] = useState( - initializeFormState(existingModData) + initializeFormState() ) const [formErrors, setFormErrors] = useState({}) @@ -70,6 +70,12 @@ export const ModForm = ({ existingModData }: ModFormProps) => { } }, [location.pathname]) // Only trigger when the pathname changes to submit-mod + useEffect(() => { + if (existingModData) { + setFormState(initializeFormState(existingModData)) + } + }, [existingModData]) + useEffect(() => { const options = games.map((game) => ({ label: game['Game Name'],