From 9e186397e0650f763d3227dc2ffd275c0a3056c6 Mon Sep 17 00:00:00 2001 From: muerwre Date: Tue, 27 Nov 2018 09:23:38 +0700 Subject: [PATCH] editor: fixed editing cancelation on empty history --- src/modules/Router.js | 1 - src/redux/user/sagas.js | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/modules/Router.js b/src/modules/Router.js index b2de803..55e2c15 100644 --- a/src/modules/Router.js +++ b/src/modules/Router.js @@ -122,7 +122,6 @@ export class Router { }; submitDrawing = () => { - console.log('ROUT', this.router); const [route] = this.router._routes; if (!route) return; diff --git a/src/redux/user/sagas.js b/src/redux/user/sagas.js index 6a90173..37f9103 100644 --- a/src/redux/user/sagas.js +++ b/src/redux/user/sagas.js @@ -28,15 +28,15 @@ function* generateGuestSaga() { function* startEmptyEditorSaga() { const { id, random_url } = yield select(getUser); - console.log('RURL', random_url); pushPath(`/${random_url}/edit`); editor.owner = id; editor.startEditing(); - return hideLoader(); + yield put(setChanged(false)); + yield put(setEditing(true)); - // todo: this.clearChanged(); + return hideLoader(); } function* startEditingSaga() { @@ -54,8 +54,11 @@ function* stopEditingSaga() { } yield editor.cancelEditing(); - yield put(setEditing(false)); yield put(setMode(MODES.NONE)); + + yield put(setChanged(false)); + + yield put(setEditing(editor.hasEmptyHistory())); // don't close editor if no previous map } function* mapInitSaga() {