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
Model references are not resolved when trying to change ranges and attach JS callback at the same time #6588
Comments
This is beautiful and exactly why we are switching to typescript. The problem is that |
@p-himik, btw., this is the kind of bug report I appreciate. Everything is here to figure it out. No need for me to even open a code editor or a web browser. |
@mattpap Wow, now I feel stupid. :) Looked at the code so much that I completely missed the recursive call that changes global var. Thanks for the explanation. |
This was fixed in PR #7233. |
@mattpap Was it though? The root cause of the issue, the global reference to |
Sure, but the inner |
@p-himik, are you sure you have most recent |
Sorry, you're right - I saw |
Bokeh: 0.12.6.
Example code:
Run with
bokeh serve
, open in your browser and press "Test" button repeatedly - after some attempts you should get an alert message.The issue is that the WS messages that are being sent as the result of this callback execution contain
references
field with an array that can contain objects in different order. If Range1d goes before CustomJS - all is fine and you don't see the error. If Range1d is after CustomJS, the references for CustomJS are not resolved as Bokeh thinks that CustomJS is an existing object.Take a look at this debug session screenshot (it's taken with a different JS code in the callback, but it doesn't matter):
In the code section, it's clearly seen that the latest value of
was_new
must have come fromref1[2]
. However, in the Scope sectionref1[2]
is true (as it should be for the new callback object), butwas_new
is false.I have not a single clue on why it happens, but apparently,
was_new
value was not set or was taken from the outer closure instead. The issue is reminiscent of asynchronous callbacks that depend on the iteration variable, but in this case, there are no asynchronous calls.The text was updated successfully, but these errors were encountered: