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

Declare LayerGroup view_module and model_module #873

Closed

Conversation

philippjfr
Copy link

The LayerGroup was not inheriting the _view_module and _model_module from the super, which meant that the view and model could not be resolved in exported contexts. I'm guessing it was intentional not to call ...super.defaults() to avoid inheriting a bunch of other attributes from the LeafletLayerModel but I'd love a confirmation of that from you @martinRenou.

Fixes #811
Fixes #761

@@ -10,6 +10,8 @@ export class LeafletLayerGroupModel extends layer.LeafletLayerModel {
return {
_view_name: 'LeafletLayerGroupView',
_model_name: 'LeafletLayerGroupModel',
_view_module: 'jupyter-leaflet',
_model_module: 'jupyter-leaflet',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this may not actually be enough, do we also need the _view_module_version and the _model_module_version?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we might need them :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I just initialize them to null?

@martinRenou
Copy link
Member

Thanks! I wonder why/how it was working without this Oo

@philippjfr
Copy link
Author

Thanks! I wonder why/how it was working without this Oo

I think this is only really critical in the static html renderer where these are used to fetch the library from NPM.

Anything else I can do here? Not sure what to initialize the version values to.

@Spreewi
Copy link

Spreewi commented Oct 19, 2021

Hello, is there any Solution for Python Users too? Or do i just not get how its done??
I am not very experienced and not able to use JS
Thanks in advance!

@philippjfr
Copy link
Author

The fix is in JavaScript but it fixes the Python ipyleaflet widget.

Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay in reviewing this

@@ -10,6 +10,10 @@ export class LeafletLayerGroupModel extends layer.LeafletLayerModel {
return {
_view_name: 'LeafletLayerGroupView',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for not looking at this more deeply the other time. This is actually missing a call to the super's defaults method:

...super.defaults(),

Similar to here: https://github.com/jupyter-widgets/ipyleaflet/blob/master/js/src/layers/AntPath.js#L11

This will merge the superclass defaults attribute which contains the proper module names and versions.

LayerGroup is actually not the only one missing this, ImageOverlay also misses it (and maybe others).

@martinRenou
Copy link
Member

I just opened #894 that replaces this PR. Thank you @philippjfr for catching this issue!

@martinRenou martinRenou closed this Dec 1, 2021
@philippjfr
Copy link
Author

Thanks @martinRenou, sorry I didn't get a chance to follow up.

@martinRenou
Copy link
Member

No worries. I should have properly reviewed your PR the first time to not waste everyone's time, totally my fault.

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.

LayerGroup not exported when saving to html Bug: ipyleaflet save via embed_minimal_html fails to plot layers
3 participants