mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
fixes: switching app version from version creation modal results in editor loading state
This commit is contained in:
parent
6f2522f5c3
commit
18bbb46814
2 changed files with 13 additions and 9 deletions
|
|
@ -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 (
|
||||
<AlertDialog
|
||||
show={showCreateAppVersion}
|
||||
|
|
@ -108,9 +114,9 @@ export const CreateVersion = ({
|
|||
<div className="ts-control" data-cy="create-version-from-input-field">
|
||||
<Select
|
||||
options={options}
|
||||
defaultValue={options.find((option) => option?.value?.id === editingVersion?.id)}
|
||||
defaultValue={selectedVersion}
|
||||
onChange={(version) => {
|
||||
setAppDefinitionFromVersion(version, false);
|
||||
setSelectedVersion(version);
|
||||
}}
|
||||
useMenuPortal={false}
|
||||
width="100%"
|
||||
|
|
|
|||
|
|
@ -811,8 +811,6 @@ const EditorComponent = (props) => {
|
|||
const paramDiff = computeComponentPropertyDiff(appDefinitionDiff, appDefinition, appDiffOptions);
|
||||
const updateDiff = computeAppDiff(paramDiff, currentPageId, appDiffOptions);
|
||||
|
||||
console.log('----arpit::', { paramDiff, updateDiff });
|
||||
|
||||
updateAppVersion(appId, editingVersion?.id, currentPageId, updateDiff, isUserSwitchedVersion)
|
||||
.then(() => {
|
||||
const _editingVersion = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue