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

Create a read-only copy of a reactiveValues() object #4188

Open
nbenn opened this issue Feb 6, 2025 · 0 comments
Open

Create a read-only copy of a reactiveValues() object #4188

nbenn opened this issue Feb 6, 2025 · 0 comments

Comments

@nbenn
Copy link

nbenn commented Feb 6, 2025

While reactiveValues() objects have a readonly flag, I could not find a way to manipulate this attribute. In my use case (which I'm happy to elaborate on), I'd like to create a ready-only copy of a reactiveValues() object and the only option I could find was "circumventing" the API by doing something like

make_read_only <- function(x) {

   res <- unclass(x)
   res[["readonly"]] <- TRUE
   class(res) <- class(x)

   res
 }

Exposing such functionality as part of the "public" API might be useful.

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

1 participant