When I visit this page: https://tonicdev.com/capicue/iss/4.0.0 the lat/long is always the same.
When it does “await currentPosition()” the values are:
But if I query the current position directly, the values are:
( http://api.open-notify.org/iss-now.json )
The values of a page are actually stored, not re-run on every load. So what you are seeing is the position of ISS when this document was run. To see the current position, you’d have to clone it and re-run it yourself.
I understand this can be confusing, and unfortunately there are often competing desires. For example, if the notebook represents a long calculation that never changes, it would not be ideal to make the user wait on every page load. Similarly, if you want to show someone a result that is outside-dependent (a url request or such), you again may not want it to change based on something outside your control, but to rather keep the current result. On the other hand, on a notebook like this, you might want that behavior. We’re open to suggestions/feedback on this, whether it be how to make this more obvious or even radically different approaches.
To further expand on this, one idea is to have inline “example cells” separate from the main code cells. These could be run by the VIEWER (vs showing what the author did), and could even be re-evaluated on load.
I agree that the current behavior is a bit confusing. It’s tripped me up a few times.
How about having a toggle somewhere that indicates the frozen vs dynamic state of a page. Something like “Remote API Data: Frozen / Dynamic” So that perhaps when you are testing out your notebook you have the toggle on “dynamic” to always fetch, then when you are ready to distribute the notebook you side the toggle to “frozen” to lock it.
I just noticed that in this documentation page, that the position does update dynamically. What’s different between the two?
TONIC_URL/clone is a link to clone a document (so say you are a teacher and this is a homework assignment, you link your students to clone so they don’t have to hit it themselves). when you append ?results=false, it WONT clone the results (normally it does). We use this for the welcome document, so that everyone gets a welcome document that is not evaluated.
Would a copy-on-write system be easier? Essentially, instead of a “clone” button, something more like an “edit this” button. When you start typing, the document is automatically cloned behind the scenes and made yours.
What I meant was that the resulting page that gets created - the api updates between page reloads. Or even when I refresh that code window. Which seems to be different behavior from the other ISS page.
I like the current Clone system as it is (seems similar to gists or jsfiddle) but my only problem with clones is there’s no reference back to the original note.
I think as long as there’s some way to toggle that caching behavior on and off that’s sufficient at least as far as what I was expecting. If I ping some REST api in a jsfiddle it’ll end up being “live” data. But I think the ability to close the results is really useful as well. So I’m not asking for you to change that, just make it possible if the note “wants” to have live api requests that there’s some affordance for it.
I think there’s still unfortunately an underlying confusion about what’s going on. It’s not that anything is either “live” or “frozen”.
The first thing to understand is that documents get evaluated when you hit run. The results of that execution live until you re-run the same document. Every time you reload that page, you’re still going to get the results of the last execution – loading a page does not re-run it.
One potentially tricky thing here is to realize that even though the results never change, the viewer of that result is reloaded, which means that if the result is a URL and you choose the viewer that loads the URL (rather than just displays the string value of the URL), it will re-fetch that URL.
The second thing to understand here is that you can only evaluate your own documents. That’s why when you visit one of our examples (without cloning it) the data looks old and there’s nothing you can do about it. If I create a notebook, anyone else who visits it will always get the results from the last time I ran it.