Making some cells non-reactive

Is there a way to make some cells non-reactive? In particular, I have cells that depend on other cells and require a lot of computational power, so I don’t want them to run automatically as other cells get updated. Instead, I want to creat separate buttons to trigger each cell to run.

Thanks!

I came up with a solution using mutables:
https://beta.observablehq.com/@tvirot/non-reactive-control-flow

Not sure if there is a better way to do this.

2 Likes

Using mutable values, in the way that you’re doing in that notebook, is a great way to accomplish what you’re looking for.

You can read directly from the HTML slider values, at compute time, or you can use the mutable keyword.

When you write mutable x = 1, it defines two different ways of accessing the variable: x, which is reactive, and will cause the cell to re-evaluate when the value is set, and mutable x, which is non-reactive.

1 Like