Fundamental questions on interactivity and refreshing data

I can use some clarification on basic concepts. Suppose I have a notebook that loads a datasource from a URL and produces a visualization. When does the data get refreshed? Here are some particular cases:

  • Does it get refreshed automatically on a timer while I’m working?
  • Does it get refreshed when I reload the page?
  • If I publish the notebook, does it get refreshed when someone loads the notebook?
  • If I embed a cell from a published notebook in another web page, and that page is loaded, is the data updated?

I could use some help with how to think of this from a conceptual point of view.

No to the first, but yes to the other three. All the data is pulled in directly to your browser, so any time the notebook is opened (by you or someone else, in Observable or an embed) it will load the data from the URL you provide. If you want to update the data source, you can either rerun the cell manually while you have the notebook open, or if you have a live data source, you could use a WebSocket or SSE (server-sent events).

One way to think about the notebook is that each cell is a separate program that you run, producing a value. Only when other cells consumed by a given cell change is the cell rerun, although you can always manually rerun the cell. Remember that Observable runs entirely in the browser, so cell outputs cannot be saved or shared with other people — opening the page simply runs all the cells.

1 Like

Here’s more on how cells run in Observable:

If you want to freeze data, we recommend file attachments. To freeze computed values, you can click Download CSV or Download JSON next to a cell (assuming its value is compatible), and then re-attach the downloaded file.