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

problem with reactive button #153

Closed
adannenberg opened this issue Dec 9, 2024 · 2 comments
Closed

problem with reactive button #153

adannenberg opened this issue Dec 9, 2024 · 2 comments

Comments

@adannenberg
Copy link

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
Copy link
Member

fonsp commented Dec 11, 2024

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.

@fonsp fonsp closed this as completed Dec 11, 2024
@adannenberg
Copy link
Author

Thanks! That makes perfect sense.

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

No branches or pull requests

2 participants