livebook-dev / kino

Client-driven interactive widgets for Livebook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Livebook does not work when offline because it cannot load JS modules from CDN

nickgnd opened this issue · comments

Hey 👋
First of all, thanks for all the work and effort you all put in this amazing tool 🙇

I was playing a bit with Livebook while being offline and I noticed the it didn't work because it couldn't load VueJS from the CDN (see screenshot).

I'm naively wondering if it would make sense to include the JS modules within the assets stored in the repo (Vue, but also vega-lite in kino_vega_lite, …). This would make Livebook working when offline too.

This is just an idea, feel free to close this issue.

Keep rocking 🎸

Screen Shot 2022-08-31 at 11 27 30 AM

Hey @nickgnd! We could definitely add those dependencies into assets, we could even use npm and a bundler if we wanted. An advantage of using a CDN is that if we use the same dependency in multiple components (outputs, smart cells), the browser needs to download it only once.

A part of the reasoning was that installing Elixir dependencies also requires an internet connection (at least the first time) and I would expect the browser to cache the CDN assets.

We may reconsider how we deal with assets as we have more of those components in the future, in either case, thanks for the suggestion :)

Hey @jonatanklosko 👋 Thank you so much for the kind reply.

A part of the reasoning was that installing Elixir dependencies also requires an internet connection (at least the first time) and I would expect the browser to cache the CDN assets.

I see, thanks for the clarification, it makes sense indeed.
Based on my experience with chrome (v104.0.5112.101), the same JS assets are fetched when I close/re-open the browser, instead they are properly cached within the same session (e.g. when opening a new tab, …). Not sure if there is a way to tweak this behaviour.

Have a great day ☺️