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

Dynamically created widgets are not updated in Blink #357

Closed
chfin opened this issue Nov 2, 2019 · 3 comments · Fixed by JuliaGizmos/Blink.jl#256
Closed

Dynamically created widgets are not updated in Blink #357

chfin opened this issue Nov 2, 2019 · 3 comments · Fixed by JuliaGizmos/Blink.jl#256

Comments

@chfin
Copy link

chfin commented Nov 2, 2019

The bug

Widgets that are dynamically (re)created and included in the ui via observables are not updated when using Blink. The following example is a simplified version of the "dynamic buttons" example in the Interact.jl tutorial.

btnshuffle = button("Shuffle")
buttons = Observable{Any}(dom"div"())
number = Observable(3)
map!(number, btnshuffle) do _
    rand(1:10)
end

function makebuttons(n)
    btns = [button(string("button ", i)) for i in 1:n]
    dom"div"(hbox(btns))
end

map!(makebuttons, buttons, number)

ui = dom"div"(btnshuffle, number, buttons)

When number is reassigned, the list of buttons is updated and shown in Jupyter but on in Blink.

Context

Provider: Blink
Errors: none (neither on REPL nor on Blink console)
]status -m WebIO Blink:

    Status `~/Uni/phd/code/schema_annotations/Manifest.toml`
  [bf4720bc]   AssetRegistry v0.1.0
  [9e28174c] + BinDeps v0.8.10
  [ad839575] + Blink v0.12.0
  [34da2185] ↑ Compat v2.1.0 ⇒ v2.2.0
  [de31a74c]   FunctionalCollections v0.5.0
  [97c1335a]   JSExpr v0.5.1
  [682c06a0]   JSON v0.21.0
  [50d2b5c4] ↓ Lazy v0.14.0 ⇒ v0.13.2
  [1914dd2f]   MacroTools v0.5.1
  [ffc61752] + Mustache v0.5.13
  [a975b10e]   Mux v0.7.0
  [510215fc]   Observables v0.2.3
  [189a3867]   Reexport v0.2.0
  [ae029012]   Requires v0.5.2
  [0f1e0344]   WebIO v0.8.11
  [104b5d7c]   WebSockets v1.5.2
  [cc8bc4a8]   Widgets v0.6.2
  [2a0f44e3]   Base64 
  [8ba89e20]   Distributed 
  [56ddb016]   Logging 
  [44cfe95a]   Pkg 
  [9a3f8284]   Random 
  [6462fe0b]   Sockets 
  [cf7118a7]   UUIDs 

versioninfo():

Julia Version 1.2.0
Commit c6da87ff4b (2019-08-20 00:03 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
@JobJob
Copy link
Member

JobJob commented Dec 1, 2019

Hi, thanks for the detailed report, sorry no one's had a chance to look at this until now.

Can you try from the Pkg REPL: add Blink#jb/fix-isopen and let me know if it works for you?

It fixes your example for me.

@chfin
Copy link
Author

chfin commented Dec 6, 2019

Yes, that works. Thanks a lot!

@chfin chfin closed this as completed Dec 6, 2019
@JobJob
Copy link
Member

JobJob commented Apr 13, 2020

I don't think this has been fixed on mainline Blink yet, so reopening.

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