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

[Feature Request]: teal::init to return shinyApp instead of a list #915

Closed
gogonzo opened this issue Sep 8, 2023 · 5 comments
Closed

[Feature Request]: teal::init to return shinyApp instead of a list #915

gogonzo opened this issue Sep 8, 2023 · 5 comments
Assignees
Labels
core enhancement New feature or request

Comments

@gogonzo
Copy link
Contributor

gogonzo commented Sep 8, 2023

teal::init to return "teal_app" object (simple S3 class). For this class we can have a print method which can look as follows:

print.teal_app <- function(x, ...) {
  cat("teal app <more information about the app>")
  shiny::shinyApp(x$ui, x$srv) 
}

Thanks to above "teal_app" object will preserve previous features (list of ui, server, ui_args, ... etc) and could be run without shinyApp(x$ui, x$server) . This would shorten the apps code:

# from
app <- teal::init(...)
shinyApp(app$ui, app$server)

# to
teal::init(...)

With the S3 class first and the second in above code would be possible.

Alternatively, print.teal_app could just print information about the app with note use shinyApp(x$ui, x$server) to run the app.

Please note that shiny works in very similar way
https://github.com/rstudio/shiny/blob/370ba1f288d3f759456ef3ef6e768ee1d7fda677/R/shinyapp.R#L552

@gogonzo gogonzo added the enhancement New feature or request label Sep 8, 2023
@gogonzo gogonzo changed the title [Feature Request]: teal::init output to have a print method [Feature Request]: teal::init to return shinyApp instead of list Oct 27, 2023
@gogonzo gogonzo changed the title [Feature Request]: teal::init to return shinyApp instead of list [Feature Request]: teal::init to return shinyApp instead of a list Oct 27, 2023
@chlebowa
Copy link
Contributor

Do you mean just adding shinyApp(ui = res$ui, server = res$server) as the return value of init?

Nothing will be broken due to this,

Besides the fact that you can't do shinyApp(app$ui, app$server) anymore, do I have this correct?

@pawelru
Copy link
Contributor

pawelru commented Nov 17, 2023

This is a potentially breaking change and if done (which I am still not sure about) it would be better to go through the formal deprecation process

@gogonzo

This comment was marked as outdated.

@vedhav

This comment was marked as outdated.

@gogonzo
Copy link
Contributor Author

gogonzo commented Feb 5, 2025

The idea doesn't make sense. Let's pay attention to #1448

@gogonzo gogonzo closed this as completed Feb 5, 2025
@gogonzo gogonzo self-assigned this Feb 5, 2025
@gogonzo gogonzo added the core label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants