Skip to content

Commit

Permalink
Fix disappearing versions (#112)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix T.J. Dietrich <[email protected]>
  • Loading branch information
farisd16 and FelixTJDietrich authored Dec 6, 2024
1 parent 14e381c commit 195ab1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ModalContentProps } from '../application-modal-types';
import { toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { useAppDispatch, useAppSelector } from '../../store/hooks';
import { selectDiagram, updateDiagramThunk } from '../../../services/diagram/diagramSlice';
import { selectDiagram, setCreateNewEditor, updateDiagramThunk } from '../../../services/diagram/diagramSlice';
import { LocalStorageRepository } from '../../../services/local-storage/local-storage-repository';
import { displayError } from '../../../services/error-management/errorManagementSlice';
import { DiagramRepository } from '../../../services/diagram/diagram-repository';
Expand Down Expand Up @@ -42,6 +42,7 @@ export const CreateVersionModal: React.FC<ModalContentProps> = ({ close }) => {
DiagramRepository.publishDiagramVersionOnServer(diagramCopy, token)
.then((res) => {
dispatch(updateDiagramThunk(res.diagram));
dispatch(setCreateNewEditor(true));
dispatch(setDisplayUnpublishedVersion(false));
LocalStorageRepository.setLastPublishedToken(res.diagramToken);
displayToast();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import { InfoCircle } from 'react-bootstrap-icons';
import { useAppDispatch, useAppSelector } from '../../store/hooks';
import { displayError } from '../../../services/error-management/errorManagementSlice';
import { useNavigate } from 'react-router-dom';
import { setDisplayUnpublishedVersion, updateDiagramThunk } from '../../../services/diagram/diagramSlice';
import {
setCreateNewEditor,
setDisplayUnpublishedVersion,
updateDiagramThunk,
} from '../../../services/diagram/diagramSlice';
import { selectDisplaySidebar, toggleSidebar } from '../../../services/version-management/versionManagementSlice';

export const ShareModal: React.FC<ModalContentProps> = ({ close }) => {
Expand Down Expand Up @@ -99,6 +103,7 @@ export const ShareModal: React.FC<ModalContentProps> = ({ close }) => {
DiagramRepository.publishDiagramVersionOnServer(diagramCopy, diagram.token)
.then((res) => {
dispatch(updateDiagramThunk(res.diagram));
dispatch(setCreateNewEditor(true));
dispatch(setDisplayUnpublishedVersion(false));
token = res.diagramToken;
})
Expand Down

0 comments on commit 195ab1c

Please sign in to comment.