JuliaGizmos / WebIO.jl

A bridge between Julia and the Web.
https://juliagizmos.github.io/WebIO.jl/latest/
Other
228 stars 64 forks source link

Example in Docs of Javascript to Julia is not working in JupyterLab Notebook #491

Open davibarreira opened 2 years ago

davibarreira commented 2 years ago

The bug

This example of Javascript to Julia is not working in Jupyter. The buttom is rendered, but once clicked, nothing is printed.

scope = Scope()
obs = Observable(scope, "rand-value", 0.0)

on(obs) do x
    println("JavaScript sent $(x)!")
end

scope(
    dom"button"(
        "Generate Random Number",
        events=Dict("click" => @js () -> $obs[] = Math.random()),
    ),
)

image

Context

Pkg.status("WebIO")

Project LuxorInteractive v0.1.0
      Status `~/MEGA/EMAp/LuxorInteractive.jl/Project.toml`
  [0f1e0344] WebIO v0.8.17

versioninfo()

Julia Version 1.7.1
Commit ac5cc99908 (2021-12-22 19:35 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 4
  JULIA_EDITOR = lvim

jupyter labextension list

JupyterLab v3.3.2
/home/davibarreira/anaconda3/share/jupyter/labextensions
        jupyterlab-jupytext v1.3.1 enabled OK (python, jupytext)
        nbdime-jupyterlab v2.1.0 enabled OK
        webio-jupyterlab-provider v0.1.0 enabled OK (python, webio_jupyter_extension)
        @jupyter-widgets/jupyterlab-manager v3.0.1 enabled OK (python, jupyterlab_widgets)

Other labextensions (built into JupyterLab)
   app dir: /home/davibarreira/anaconda3/share/jupyter/lab
        @axlair/jupyterlab_vim v0.13.4 enabled OK
        jupyterlab-plotly v5.7.0 enabled OK
davibarreira commented 2 years ago

The package works when I run a brand new notebook. Yet, once I restart the kernel, it stops working. It does not work ever again, even if I restart jupyter or even reinstall the whole thing. Thus, I need to create a new notebook every time in order to get it to work.

I figure the issue is not actually the WebIO.jl package, but something with my jupyter/system configuration. If you guys know anything about this issue, I'd love some help. Tried reinstalling everything, to no avail.