Skip to content
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

Shinylive.io sharing link #80

Open
JoaoGarcezAurelio opened this issue May 20, 2024 · 5 comments
Open

Shinylive.io sharing link #80

JoaoGarcezAurelio opened this issue May 20, 2024 · 5 comments

Comments

@JoaoGarcezAurelio
Copy link

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!

@seanbirchall
Copy link

@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.

@georgestagg
Copy link
Collaborator

Hi @JoaoGarcezAurelio, if your sharing URL is too long here are two alternative approaches you could try:

  1. Rather than building your Shiny app in shinylive.io, instead create a local traditional Shiny app on your machine and use the {shinylive} package's export() function to create a bundle of static files. Instructions are here. `the output folder can then be shared via GitHub Pages, Netlify Drop, or any other static file hosting service.

  2. Alternatively, you could create a GitHub gist containing your Shiny app code. The Shinylive website for both R and Python supports loading an app via Github gist. See the documentation here for more information and instructions. Though, for R apps be sure to change the /py/ parts of the URL in the instructions to /r/, so that the Shiny for R engine is loaded.

@JoaoGarcezAurelio
Copy link
Author

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.
Finally, thank you both for working on this. It may be you hear this often, but these types of options are brilliant and make a real difference to non-technical people like me.

@georgestagg
Copy link
Collaborator

georgestagg commented May 21, 2024

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"

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.

@JoaoGarcezAurelio
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants