posit-dev / r-shinylive

https://posit-dev.github.io/r-shinylive/
Other
166 stars 17 forks source link

When following the shinylive tutorial you currently get a blank page when previewing static server #121

Closed StefKirsch closed 2 months ago

StefKirsch commented 2 months ago

I've been playing around with this tutorial today. When I follow it in RStudio locally, I am getting a blank page as soon as I run

httpuv::runStaticServer("site/")

I installed the development version of shinylive as indicated. But I get the same result when I use the stable version 0.2.0 from CRAN.

The only way that I tried and got it to work was downgrading to version 0.1.1 and rebuilding the site.

I built out everything in this repository to reproduce the issue. I might add another branch with site builds with different shinylive versions.

virtualinertia commented 2 months ago

Same experience on Posit Cloud.

The shinylive::export("shiny_app_dir", "site_dir") command fails for me.

It builds a static website structure with apparently broken javascript.

This is a simple Shiny app that works on Posit Cloud and works for everyone when deployed to shinyapp.io at https://323kwp-alex-karman.shinyapps.io/nld_data_catalog/ .

It is a very simple app with only four files in it, you can clone it from my public github repo at https://github.com/virtualinertia/nld_data_catalog_shiny .

But when I try to convert it by running shinylive::export("nld_data_catalog", "site") it produces a static website in a "site" directory that does not work. The browser freezes. This happens in Posit Cloud but also when I download it and try to run it locally by loading index.html.

gadenbuie commented 2 months ago

@StefKirsch were you also trying to view the app using Posit Cloud? Or were you having trouble locally?

StefKirsch commented 2 months ago

@StefKirsch were you also trying to view the app using Posit Cloud? Or were you having trouble locally?

I'm working locally in RStudio. I updated my comment to reflect that. 😊

gadenbuie commented 2 months ago

The only way that I tried and git it to work was downgrading to version 0.1.1 and rebuilding the site.

I think this might be an indication that your browser has cached parts of the old version of the site and that when you're trying it with the new version of shinylive it might be using some of those cached assets instead of the newer ones.

Try refreshing your browser on the page with the shinylive app. Sometimes you need to do a "hard refresh" (how to do that depends on your browser and operating system).

StefKirsch commented 2 months ago

The only way that I tried and git it to work was downgrading to version 0.1.1 and rebuilding the site.

I think this might be an indication that your browser has cached parts of the old version of the site and that when you're trying it with the new version of shinylive it might be using some of those cached assets instead of the newer ones.

Try refreshing your browser on the page with the shinylive app. Sometimes you need to do a "hard refresh" (how to do that depends on your browser and operating system).

Awesome, clearing the cached files indeed solves the issue! 🎉 Thanks a lot!

georgestagg commented 2 months ago

Following up on a conversation with @gadenbuie at posit::conf(). We need to improve the failure mode when the Shinylive JS Service Worker fails to load. I've opened an issue about that here: https://github.com/posit-dev/shinylive/issues/171