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

very simple dynamic map code creates an invalid state #3691

arabidopsis opened this issue May 5, 2019 · 1 comment

very simple dynamic map code creates an invalid state #3691

arabidopsis opened this issue May 5, 2019 · 1 comment


Copy link

@arabidopsis arabidopsis commented May 5, 2019

This simple code puts the dynamicmap into an invalid state

import numpy as np
import holoviews as hv
x = np.linspace(0, 10, 10)
def f(s):
    return hv.Curve((x, x * s))
s = hv.Dimension('scale', default=2, values=[1,2,3,4])
dd = hv.DynamicMap(f, kdims=[s])
d2 = dd.opts(color='red')

hv.__version__ == '1.12.2'

I expect d2[(3,)] to return a curve, but it returns a DynamicMap, In fact
d2 now contains itself as a child and will not render giving:

Exception: Nesting a DynamicMap inside a DynamicMap is not supported. Ensure that the DynamicMap callback returns an Element or (Nd)Overlay. If you have applied an operation ensure it is not dynamic by setting dynamic=False.

Supplying clone=True to the opts call fixes the problem. Maybe there
is some documentation saying that you should always supply clone=True to
a dynamic map but I couldn't find it.

I ran it through the debugger and think that the monkey patching
that goes on in Opts._dynamicmap_opts (lines 441-446) seems to
me to be the culprit... but frankly don't really know.. the code is pretty hairy!

The above - IMHO - should either work or return an error stating you
need to supply clone=True.

Copy link

@philippjfr philippjfr commented May 5, 2019

That code is pretty hairy indeed, and this is a pretty bad bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants