diff --git a/frontend/src/Editor/AppVersionsManager/CreateVersionModal.jsx b/frontend/src/Editor/AppVersionsManager/CreateVersionModal.jsx index 290711aa84..8802936202 100644 --- a/frontend/src/Editor/AppVersionsManager/CreateVersionModal.jsx +++ b/frontend/src/Editor/AppVersionsManager/CreateVersionModal.jsx @@ -17,6 +17,7 @@ export const CreateVersion = ({ }) => { const [isCreatingVersion, setIsCreatingVersion] = useState(false); const [versionName, setVersionName] = useState(''); + const { t } = useTranslation(); const { editingVersion } = useAppVersionStore( (state) => ({ @@ -25,6 +26,14 @@ export const CreateVersion = ({ shallow ); + const options = appVersions.map((version) => { + return { label: version.name, value: version }; + }); + + const [selectedVersion, setSelectedVersion] = useState(() => + options.find((option) => option?.value?.id === editingVersion?.id) + ); + const createVersion = () => { if (versionName.trim().length > 25) { toast.error('Version name should not be longer than 25 characters'); @@ -36,8 +45,9 @@ export const CreateVersion = ({ } setIsCreatingVersion(true); + appVersionService - .create(appId, versionName, editingVersion.id) + .create(appId, versionName, selectedVersion.id) .then((data) => { toast.success('Version Created'); appVersionService.getAll(appId).then((data) => { @@ -62,10 +72,6 @@ export const CreateVersion = ({ }); }; - const options = appVersions.map((version) => { - return { label: version.name, value: version }; - }); - return (