staging #23
@ -25,8 +25,8 @@ import {
|
||||
} from '../utils'
|
||||
import { CheckboxField, InputError, InputField } from './Inputs'
|
||||
import { RelayController } from '../controllers'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { getModsInnerPageRoute } from '../routes'
|
||||
import { useLocation, useNavigate } from 'react-router-dom'
|
||||
import { appRoutes, getModsInnerPageRoute } from '../routes'
|
||||
import { DownloadUrl, ModFormState, ModDetails } from '../types'
|
||||
import { LoadingSpinner } from './LoadingSpinner'
|
||||
import { T_TAG_VALUE } from '../constants'
|
||||
@ -55,6 +55,7 @@ type ModFormProps = {
|
||||
}
|
||||
|
||||
export const ModForm = ({ existingModData }: ModFormProps) => {
|
||||
const location = useLocation()
|
||||
const navigate = useNavigate()
|
||||
const userState = useAppSelector((state) => state.user)
|
||||
|
||||
@ -64,6 +65,12 @@ export const ModForm = ({ existingModData }: ModFormProps) => {
|
||||
initializeFormState(existingModData)
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (location.pathname === appRoutes.submitMod) {
|
||||
setFormState(initializeFormState())
|
||||
}
|
||||
}, [location.pathname]) // Only trigger when the pathname changes to submit-mod
|
||||
|
||||
const [formErrors, setFormErrors] = useState<FormErrors>({})
|
||||
|
||||
useEffect(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user