-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sharing large apps when the shinylive.io sharing link is over 32,000 characters #80
Comments
@JoaoGarcezAurelio For apps that have too large of a code base there's not much that can be done aside from creating some lookup table service. Possible example: Posit has allowed for free publishing of rmd documents on rpubs since I started writing R code. They could create a service that publishes a share linked code as some uuid or md5 function of the underlying code. Which then fetches the actual code saved to this additional service using said uuid or md5 as the lookup. Right now shinylive py/r just uses a compression algorithm + base64 url encoded strings which allows shinylive users to share links without this additional service so long as they're not too large. Most browsers have a limit around ~2000 characters so if this string is longer than that for large apps there's not much that can be done aside from creating an additional service which costs money. |
Hi @JoaoGarcezAurelio, if your sharing URL is too long here are two alternative approaches you could try:
|
Hi @seanbirchall and @georgestagg, thank you both for taking time to reply to this query, I really appreciate it. With regard to the shinylive option that @georgestagg mentioned, that was my initial aim, but I am unable to get it to render as I get a warning stating that "Robj construction for this JS object is not yet supported". I also tried shinyio but there I get a different error, flagging libarchive, which I have been told in stackoverflow is due to shiny not supporting libarchive at the moment. I will try the GitHub gist option suggested. I will try to also look into @seanbirchall suggestion, I was not able to follow some of the input but will try to research it. |
That is a fairly generic error that just indicates something has gone wrong internally between Shinylive and webR. Are there any other error messages in the JavaScript console? It would be good to track down exactly what is causing it, so if you can share a small reproducible app that causes that error that would be very useful. In the meantime, ensuring sure you're running the latest version of the r-shinylive package: install.packages("shinylive") and that the shinylive assets are up to date: shinylive::assets_download() might help. |
Hi @georgestagg, happy to share it, I based the app on Garret Gromelund's feedback on shiny apps and followed your Youtube talk mentioning how to best implement the process. The app is here: https://github.com/JoaoGarcezAurelio/Passport-survey-completion/tree/main/completion_rates_app and it runs in my machine and in the shinylive.io. Would you advise sharing it in a particular setting? Will implement your suggestion, I assume shinylive is up to date as i updated it a couple of days ago, but will run the assets. Thank you once again for all the suggestions and time! |
Sorry it's taken me a while to get back to this. @JoaoGarcezAurelio, were you able to share your app in the end? I unfortunately cannot access the URL you posted above for testing. An alternative method I've just thought of would be to embed your app in a Quarto document using the Quarto Shinylive extension: https://github.com/quarto-ext/shinylive, and then publishing the resulting document on e.g. GitHub Pages. |
Hi @georgestagg , no problem whatsoever, thank you for getting back to me. I ended up deleting the repository. |
Yes, that's correct.
You shouldn't need any direct Python knowledge, it's just that the README for that repository was written before Shinylive for R was available, so it's directly targeting Shinylive for Python. In principle, the following should be enough to get a shinylive for R app up and running in Quarto: Step 1: Install the shinylive extension, running the following in a terminal with the current directory set to a Quarto project:
Step 2: Create a document including a shinylive for R app: ---
title: Shinylive in Quarto
format: html
filters:
- shinylive
---
:::{.column-screen}
```{shinylive-r}
#| viewerHeight: 600
#| components: [editor, viewer]
#| standalone: true
library(shiny)
library(bslib)
ui <- page_sidebar(
title = "Hello Shiny!",
sidebar = sidebar(
sliderInput(
inputId = "bins",
label = "Number of bins:",
min = 1,
max = 50,
value = 30
)
),
plotOutput(outputId = "distPlot")
)
server <- function(input, output) {
output$distPlot <- renderPlot({
x <- faithful$waiting
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(
x,
breaks = bins,
col = "#75AADB",
border = "white",
xlab = "Waiting time to next eruption (in mins)",
main = "Histogram of waiting times"
)
})
}
shinyApp(ui = ui, server = server)
```
::: Once you are happy, you'd publish the Quarto document in the usual way, by running:
in a terminal. |
Brilliant, will give that a try :) Thank you for taking the time to help, it makes a massive difference 👍🏼 All the best and have a nice day! |
Hi there,
I hope you are well. I am contacting because having followed the youtube videos about shinylive I found it to be very interesting. Having managed to create a shiny app in shinylive.io, I was surprised that when it came to sharing the link said link had over 32000 characters, meaning it could not be used in shortening url websites. I am wondering if this is something the team plans to address in the future?
Thank you!
The text was updated successfully, but these errors were encountered: