JuliaPluto/PlutoSliderServer.jl

problem with reactive button

Closed this issue · 2 comments

i use the reactive button trick with pluto to force a new random number dependent calculation. specifically, i have a line:
@bind go Button("Recompute")
in one cell and another cell that looks like this:

begin
	go
	ob =function1()
	output1, output2 = function2(ob);
	Print()
end

where function1 invokes rand()

i followed the readme and did

using PlutoSliderServer
path_to_notebook = download("https://raw.githubusercontent.com/fonsp/Pluto.jl/v0.17.2/sample/Interactivity.jl") # fill in your own notebook path here!

PlutoSliderServer.run_notebook(path_to_notebook)

with my own repo and pluto file and the webpage renders fine but the button is not active, i.e. doesn't cause a re-evaluation (apparently).

am i doing something wrong or is PlutoSliderServer not yet working with a bound Button object?

thanks for any guidance.

fonsp commented

Hey! You can use a CounterButton from PlutoUI instead of Button and it will work!

The problem is that PlutoSliderServer works with caching, and the Button will give the same value every time you click.

Thanks! That makes perfect sense.