From 0ee06293494f4d9a66a1fa619176a3f9cc00512d Mon Sep 17 00:00:00 2001 From: Jason Park Date: Sat, 11 Aug 2018 22:48:33 +0900 Subject: [PATCH] Don't warn about unsaved changes when deleting a scratch paper --- src/frontend/components/App/index.jsx | 8 ++++---- src/frontend/components/Header/index.jsx | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/frontend/components/App/index.jsx b/src/frontend/components/App/index.jsx index 99cc522..6d981f0 100644 --- a/src/frontend/components/App/index.jsx +++ b/src/frontend/components/App/index.jsx @@ -123,8 +123,8 @@ class App extends React.Component { .catch(this.props.showErrorToast); } - loadAlgorithm({ categoryKey, algorithmKey, gistId }) { - if (!this.isGistSaved() && !window.confirm('Are you sure want to discard changes?')) return; + loadAlgorithm({ categoryKey, algorithmKey, gistId }, forceLoad = false) { + if (!forceLoad && !this.isGistSaved() && !window.confirm('Are you sure want to discard changes?')) return; const { ext } = this.props.env; let fetchPromise = null; @@ -249,12 +249,12 @@ class App extends React.Component {
this.toggleNavigatorOpened()} navigatorOpened={navigatorOpened} loadScratchPapers={() => this.loadScratchPapers()} - loadAlgorithm={params => this.loadAlgorithm(params)} gistSaved={gistSaved} + loadAlgorithm={this.loadAlgorithm.bind(this)} gistSaved={gistSaved} file={file} /> this.handleChangeWorkspaceWeights(weights)}> - this.loadAlgorithm(params)} /> + this.handleChangeEditorTabIndex(tabIndex)}> diff --git a/src/frontend/components/Header/index.jsx b/src/frontend/components/Header/index.jsx index 4004637..2e6242b 100644 --- a/src/frontend/components/Header/index.jsx +++ b/src/frontend/components/Header/index.jsx @@ -69,7 +69,7 @@ class Header extends React.Component { const { gistId } = this.props.current; const deletePromise = gistId === 'new' ? Promise.resolve() : GitHubApi.deleteGist(gistId); deletePromise - .then(() => this.props.loadAlgorithm({})) + .then(() => this.props.loadAlgorithm({}, true)) .then(this.props.loadScratchPapers) .catch(this.props.showErrorToast); } -- GitLab