Skip to content

Commit

Permalink
Tighten workspace loading command to make sure it can only run once. …
Browse files Browse the repository at this point in the history
…This may change in the future.
  • Loading branch information
afshin committed Jan 12, 2018
1 parent 78e0a7c commit 2890119
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/apputils-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,14 @@ const state: JupyterLabPlugin<IStateDB> = {
// Populate the workspace placeholder.
workspace = decodeURIComponent((args.path.match(pattern)[1]));

// This command only runs once, when the page loads.
if (resolved) {
console.warn(`${command} was called after state resolution.`);
return;
}

// If there is no workspace, leave the state database intact.
if (!workspace && !resolved) {
if (!workspace) {
resolved = true;
transform.resolve({ type: 'cancel', contents: null });
return;
Expand Down
2 changes: 1 addition & 1 deletion packages/vega2-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class RenderedVega extends Widget implements IRenderMime.IRenderer {
return new Promise<void>((resolve, reject) => {
embedFunc(this.node, embedSpec, (error: any, result: any): any => {
if (error) {
return reject(error);
return; /*reject(error);*/
}

// Save png data in MIME bundle along with original MIME data.
Expand Down

0 comments on commit 2890119

Please sign in to comment.