提交 0ee06293 编写于 作者: J Jason Park

Don't warn about unsaved changes when deleting a scratch paper

上级 cc7ea60f
......@@ -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 {
</Helmet>
<Header className={styles.header} onClickTitleBar={() => this.toggleNavigatorOpened()}
navigatorOpened={navigatorOpened} loadScratchPapers={() => this.loadScratchPapers()}
loadAlgorithm={params => this.loadAlgorithm(params)} gistSaved={gistSaved}
loadAlgorithm={this.loadAlgorithm.bind(this)} gistSaved={gistSaved}
file={file} />
<ResizableContainer className={styles.workspace} horizontal weights={workspaceWeights}
visibles={[navigatorOpened, true, true]}
onChangeWeights={weights => this.handleChangeWorkspaceWeights(weights)}>
<Navigator loadAlgorithm={params => this.loadAlgorithm(params)} />
<Navigator loadAlgorithm={this.loadAlgorithm.bind(this)} />
<VisualizationViewer className={styles.visualization_viewer} />
<TabContainer className={styles.editor_tab_container} titles={editorTitles} tabIndex={editorTabIndex}
onChangeTabIndex={tabIndex => this.handleChangeEditorTabIndex(tabIndex)}>
......
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册