Skip to content

Commit

Permalink
#7611 fix CodeCells not working in Lab
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz Jurowicz committed Jul 2, 2018
1 parent 4d4eb52 commit f92b109
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5,913 deletions.
2 changes: 1 addition & 1 deletion js/lab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@jupyterlab/outputarea": "^0.15.2",
"@jupyterlab/rendermime": "^0.15.2",
"@jupyterlab/rendermime-interfaces": "^1.0.4",
"@jupyterlab/services": "^1.1.2",
"@jupyterlab/services": "^1.1.4",
"@phosphor/datagrid": "^0.1.6",
"@types/node": "^8.0.56",
"rimraf": "^2.6.2",
Expand Down
21 changes: 11 additions & 10 deletions js/lab/src/plugin/codeCells.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ export function sendJupyterCodeCells(
notebook: Notebook,
filter: string
): void {
const comm = kernelInstance.connectToComm(BEAKER_GETCODECELLS);
const codeCells = <JSONArray>getCodeCellsByTag(notebook, filter)
.map((cell: CodeCell): object => ({
cell_type: cell.model.type,
...cell.model.toJSON()
})
);
kernelInstance.connectToComm(BEAKER_GETCODECELLS)['then'](comm => {
const codeCells = <JSONArray>getCodeCellsByTag(notebook, filter)
.map((cell: CodeCell): object => ({
cell_type: cell.model.type,
...cell.model.toJSON()
})
);

comm.open();
comm.send({ code_cells: codeCells });
comm.dispose();
comm.open();
comm.send({ code_cells: codeCells });
comm.dispose();
});
}

export function getCodeCellsByTag(notebook: Notebook, tag: string): Cell[] {
Expand Down
6 changes: 3 additions & 3 deletions js/lab/src/plugin/comm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ const assignMsgHandlersToExistingComms = (
msgHandlers: Object
): void => {
for (let commId in comms) {
let comm = kernelInstance.connectToComm(comms[commId].target_name, commId);

assignMsgHandlerToComm(comm, msgHandlers[comm.targetName]);
kernelInstance.connectToComm(comms[commId].target_name, commId)['then'](comm => {
assignMsgHandlerToComm(comm, msgHandlers[comm.targetName]);
});
}
};

Expand Down
Loading

0 comments on commit f92b109

Please sign in to comment.