Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where the same plot could appear multiple times #32

Merged
merged 1 commit into from
Oct 31, 2019

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Oct 30, 2019

Notebook html generated with pyganja output would contain javscript akin to:

function add_graph_to_notebook() { foo(); }
call_soon(() => add_graph_to_notebook());
function add_graph_to_notebook() { bar(); }
call_soon(() => add_graph_to_notebook());

If line 3 runs before soon expires on line 2, then bar() gets called twice, and foo() doesn't get called at all.

This fixes things by not naming the function at all.

It seems the comment about requirejs vs require was wrong - requirejs works in both places.

Fixes pygae/clifford#170

Notebook html generated with pyganja output would contain javscript akin to:

```
function add_graph_to_notebook() { foo(); }
call_soon(() => add_graph_to_notebook());
function add_graph_to_notebook() { bar(); }
call_soon(() => add_graph_to_notebook());
```

If line 3 runs before `soon` expires on line 2, then `bar()` gets called twice, and `foo()` doesn't get called at all.

This fixes things by not naming the function at all.

It seems the comment about `requirejs` vs `require` was wrong - `requirejs` works in both places.
@eric-wieser eric-wieser merged commit 710b9dc into pygae:master Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ganja embedded plots appear twice sometimes in the docs
1 participant