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

Event serialization breaks "simple" events #78

Closed
mgmarino opened this issue Sep 5, 2023 · 4 comments · Fixed by #79
Closed

Event serialization breaks "simple" events #78

mgmarino opened this issue Sep 5, 2023 · 4 comments · Fixed by #79

Comments

@mgmarino
Copy link

mgmarino commented Sep 5, 2023

Recent updates (e.g. #76) to event serialization have broken more simple events, e.g. the change events of Tabs that expect to deliver a string. Other examples are change events of e.g. Select boxes.

Example (using ipyvuetify, but I did determine the changes arise from the code touched above):

import ipyvuetify as v


def _print_change(_, __, tab):
    print(tab)

t = v.Tabs(
    show_arrows=True,
    children=[
        v.Tab(children=["Tab1"], href="#tab1"),
        v.Tab(children=["Tab2"], href="#tab2"),
    ],
    v_model="tab2"
)
t.on_event("change", _print_change)
t

which will output (on clicking the tabs):

{'0': 't', '1': 'a', '2': 'b', '3': '1'}
{'0': 't', '1': 'a', '2': 'b', '3': '2'}

instead of the expected:

tab1
tab2
@maartenbreddels
Copy link
Collaborator

Thank you for the issue Michael, #79 should fix this.

@mgmarino
Copy link
Author

mgmarino commented Sep 6, 2023

Thanks for the quick work on this, @maartenbreddels! I did try to have a go, but got stuck on wanting to write tests, so I'm happy there is now an example on how to do that.

Just as a heads up, we actually stumbled across this issue although we were using an older version of ipyvue (<=1.9.2), both in voila and (I think) in jupyter lab. For some reason it was pulling in new code from somewhere.

We fixed voila by rather serving the extensions directly (we are still < 0.5.0, so --enable_nbextensions worked) instead of from CDN, but I couldn't figure out why going from CDN was referencing newer code. Re jupyter lab, I swear it wasn't working yesterday, but now it is, so maybe something got fixed here? I can try to have a look and make a reproducible test case, unless you have an idea where that could have come from?

@maartenbreddels
Copy link
Collaborator

Due to

_view_module_version = Unicode(semver).tag(sync=True)
and
semver = "^" + __version__
our version "^1.9.2" will happily get "^1.10.0".

@mariobuikhuizen I think we should not do that, it makes cdn fetching different from a local install, and to me makes no sense whatsoever. I think we could do "~x.y.z" but a strict match "x.y.z" might make more sense.

In Jupyter Lab it could be that you've hit a cache issue? Maybe it was using JS assets from cache?

If you like voila+ipyvuetify (assuming you also use ipyvuetify) you might also be interested in https://github.com/widgetti/solara/

@mgmarino
Copy link
Author

mgmarino commented Sep 6, 2023

Ok, thx. +1 for having the strict match, then it's on the user to explicitly upgrade, I like reproducible environments! :-)

Thanks for the tip on solara, yes, we have been happy with voila + ipyvuetify + others, it has been our production "dashboard" server for internal use for almost 4 years. :-) I'll have to take a look at solara.

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 a pull request may close this issue.

2 participants