Open DivadNojnarg opened 7 months ago
As discussed in https://github.com/r-wasm/actions/issues/15#issuecomment-1924234922, we changed the default so that package dependencies are not included in a CRAN-like repo by default. It's possible the rwasm
package documentation is out of date, but we plan to rework it all at some point in any case.
I am able to make your repository work by including the default webR binary repository as a fallback for all the dependent packages.
webr::install(
"shinyMobile",
repos = c("https://rinterface.github.io/rinterface-wasm-cran/", "https://repo.r-wasm.org")
)
> library(shinyMobile)
> shinyMobile::getF7Colors()
[1] "primary" "red" "green" "blue" "pink" "yellow"
[7] "orange" "purple" "deeppurple" "lightblue" "teal" "lime"
[13] "deeporange" "gray" "black"
The goal here was to put and try a development version of shinyMobile, that is 2.0.0. The official wasm CRAN points to 1.0.1 that is the latest CRAN release and not the version I need.
Using this method should indeed load shinyMobile v2.0.0 in webR. The repository list is ordered: your custom repo will be tried first, and the remaining package dependencies will be loaded from the webR repository fallback so as to match CRAN releases.
This works on the webR demo (https://webr.r-wasm.org/latest/)
But not on from shinylive.
Trying with incognito mode, clearing browser cache does not change anything.
There's some strange behaviour in shinylive, my wild guess is that it's something related to timing.
We can make it work, but there are specific steps needed:
library(shinyMobile)
- which encounters an error because it can't find f7Page
but that's finelibrary(shinyMobile)
and run it againThis way it is using the 2.0.0:
But refreshing the shinylive page and directly using this code (without letting it fail first):
webr::install(
"shinyMobile",
repos = c("https://rinterface.github.io/rinterface-wasm-cran/", "https://repo.r-wasm.org")
)
library(shiny)
library(shinyMobile)
app <- shinyApp(
ui = f7Page(
title = "Update f7SmartSelect",
f7SingleLayout(
navbar = f7Navbar(title = "Update f7SmartSelect"),
f7Block(f7Button("update", "Update Smart Select")),
f7List(
inset = TRUE,
strong = TRUE,
outline = TRUE,
f7SmartSelect(
inputId = "smartselect",
label = "Choose a variable:",
choices = split(colnames(mtcars[-1]), rep(1:5)),
openIn = "popup"
)
),
tableOutput("data")
)
),
server = function(input, output, session) {
output$data <- renderTable(
mtcars[, c("mpg", input$smartselect), drop = FALSE],
rownames = TRUE
)
observeEvent(input$update, {
updateF7SmartSelect(
inputId = "smartselect",
openIn = "sheet",
selected = "hp",
choices = c("hp", "gear", "carb"),
multiple = TRUE,
maxLength = 2
)
})
}
)
app
Will return 1.0.1
Thank you both for this great debugging information! I now know what is going wrong.
In Shinylive, there is some startup code to search for dependencies in an app and automatically install them before the app has loaded. With this, users do not need to know about webr::install()
. However, the code does not take into account downloading from alternative repositories. I have opened an issue about it here: https://github.com/posit-dev/shinylive/issues/125.
For the moment, while far from ideal, there should be a workaround in removing the automatically installed version of shinyMobile
before running webr::install()
:
webr::unmount("/usr/lib/R/library/shinyMobile")
webr::install(
"shinyMobile",
repos = c("https://rinterface.github.io/rinterface-wasm-cran/", "https://repo.r-wasm.org")
)
Hopefully, we can get this fixed either by introducing some way to list repositories for automatic package download or by making webr::install()
installed packages have higher priority.
Thanks George!
Below is what I did for a recent project:
{shinyMobile}
from the provided url: https://rinterface.github.io/rinterface-wasm-cran/. Demo shinylive app is here[[headers]] for = "/" [headers.values] Access-Control-Allow-Origin = "" Access-Control-Allow-Headers = "" Access-Control-Allow-Methods = ""
webr::install("gplots") webr::install("shinyMobile", repos = "https://66199b8ebceb89385d143187--frabjous-twilight-b36d68.netlify.app/")
Working well