Fork me on GitHub
#reveal
<
2020-12-06
>
seancorfield00:12:14

@vlaaad Any idea why a :web-view would seem to cache a rendered page? In my observable view, if it gets a .URL, it produces a :web-view for that URL. When I give it the URL of my localhost server, it doesn't always seem to make the request -- sometimes it renders a blank page, sometimes I have to run the eval twice to get the updated page.

vlaaad12:12:52

Hmm, cljfx skips URL reload if new value is the same as old one, maybe that's the behavior you are seeing?

vlaaad13:12:58

If you tap url to the same external page twice in a row it will only load it once

seancorfield18:12:18

Even with a cache buster to make the url unique it still seems to only load the page every other time.

seancorfield18:12:30

It makes using the internal browser in Reveal really hard. I'm trying to use it for viewing the web app that I'm developing, so it needs to fetch the url every time.

vlaaad19:12:48

I think this cache buster has to be in the URL itself that is tapped for it to work. Cljfx assumes it works with pure functions

vlaaad19:12:42

Although I would expect for observable fn to be called on every change... I'll have a look when I'll be at a computer

seancorfield19:12:50

I'm evaluating (.URL. (str "" (rand-int 10000))) via tap> and the observable view's function returns a (new?) :web-view hash map each time.

seancorfield19:12:24

The REPL shows the URL is different every time. Debugging in the web app shows it is only being invoked on every other URL.

vlaaad19:12:21

Can't reproduce it with simple http server — the endpoint gets triggered every time for me, and web view is refreshed every time as well

vlaaad19:12:28

tried with python -m SimpleHTTPServer

seancorfield19:12:49

Interesting. I wonder if it's somehow because the http server I'm running is inside the REPL/JVM that is also running Reveal and therefore invoking the web-view?

seancorfield20:12:43

I see the eval of the .URL and it shows the unique URL each time. I'll go through the code in more detail and see if I can figure out where the ball is being dropped in the chain.

👍 3
seancorfield00:12:59

If I add a cache buster to the URL (`(str url "?" (rand-int 10000))`) then it seems to make every other request (consistently).

seancorfield00:12:53

(I wonder if it only does this for http: links? It seems to request https: links every time...)