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

Can shinyoutput entries be removed? #1989

Closed
mmuurr opened this issue Mar 26, 2018 · 1 comment
Closed

Can shinyoutput entries be removed? #1989

mmuurr opened this issue Mar 26, 2018 · 1 comment
Assignees
Milestone

Comments

@mmuurr
Copy link

mmuurr commented Mar 26, 2018

Can we remove elements from a shinyoutput object?
Some simple testing suggests no (at least not with the first few obvious guesses):

## in shinyServer(function(input, output, session)):

output$foo <- renderText("foo")

## rm(output[["foo"]]) ## doesn't work
## output[["foo"]] <- NULL ## also doesn't work

The reason for wanting such a function is to prevent server-side memory accumulation in long-running applications that frequently call insertUI() & removeUI().

For example, insertUI() might insert a dynamically-generated textOutput("foo", ...) element coupled to a corresponding output[["foo"]] <- renderText(...) assignment to the session's output object. Later, when removeUI() removes the textOutput("foo", ...) element, I'd like to 'clean-up' the session's output object by removing the output[["foo"]] entry. (In this example, "foo" is a randomly-generated unique ID.)

For applications where this is a frequent procedure the UI-side of the application can be kept tidy, but I suspect the server-side output object simply continues to accumulate these entries.

Is there any way to remove a specific entry in the output object by that entry's ID?
(I can't find any such function/procedure in the docs.)

@jcheng5 jcheng5 added this to the 1.1 milestone Apr 10, 2018
@jcheng5
Copy link
Member

jcheng5 commented Apr 10, 2018

Note: "doesn't work" means

Error in .subset2(x, "impl")$defineOutput(name, value, label) : 
  Unexpected NULL output for plot

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

2 participants