Skip to content

Commit

Permalink
Save notebook before publishing (#33)
Browse files Browse the repository at this point in the history
Before this PR we incorrectly assumed the notebook was saved and the latest
changes would make it to the server. This PR fixes that incorrect assumption and
saves the notebook before we attempt to publish.
  • Loading branch information
Jonathan Curran authored Jul 9, 2018
1 parent fb543ce commit 87fa328
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions rsconnect/static/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -850,11 +850,24 @@ define([
window.RSConnect = config;
}

if (Object.keys(config.servers).length === 0) {
showAddServerDialog(false).then(showSelectServerDialog);
} else {
showSelectServerDialog(config.previousServerId);
}
// save before publishing so the server can pick up changes
Jupyter.notebook
.save_notebook()
.then(function() {
if (Object.keys(config.servers).length === 0) {
showAddServerDialog(false).then(showSelectServerDialog);
} else {
showSelectServerDialog(config.previousServerId);
}
}).catch(function(err) {
// unlikely but possible if we aren't able to save
debug.error("Failed to save notebook:", err);
Dialog.modal({
title: 'rsconnect-jupyter',
body: 'Failed to save this notebook. Error: ' + err,
buttons: {Ok: {class: 'btn-primary'}}
});
});
}

return {
Expand Down

0 comments on commit 87fa328

Please sign in to comment.