-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Ensured dynamic callback is only called once #923
Conversation
Great! The PR referenced above is an example notebook that needs this fix. It is also good to have those unit tests to make sure this bug is squashed for good. I'll now review the proposed changes... |
@@ -967,7 +968,8 @@ def get_dynamic_item(map_obj, dimensions, key): | |||
key_offset = max([key-map_obj.cache_size, 0]) | |||
key = map_obj.keys()[min([key-key_offset, | |||
len(map_obj)-1])] | |||
el = map_obj.map(lambda x: x[key], ['DynamicMap']) | |||
el = map_obj.map(lambda x: x[key], ['DynamicMap'], | |||
clone=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor nitpick: I don't see why clone=False
needs to be on the next line in this case. Even if it is over 80 characters long it looks a bit weird...
def test_stream_callback_single_call(self): | ||
def history_callback(x, history=deque(maxlen=10)): | ||
history.append(x) | ||
return Curve(list(history)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just like the price stream example notebook in contrib!
The actual fix is very small and the tests looks good. Happy to merge if you feel it is ready... |
Once the tests pass let's merge it. |
Tests passed. Merging. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
A bug in the
get_dynamic_item
function ended up making clones of DynamicMaps which resulted in the dynamic callback being called multiple times. This PR fixes this and adds unit tests for all three backends to ensure the plot is appropriately updated.