Skip to content

reactlog_write() output can not be used after being read back #71

Closed

Description


How to download the intreactive Reactlog

I want to download or store the html file produced by reactlog so that i can see it later even if the program is closed or the reactlog is reset.
There is a reactlog_write() function that puts it into a json file but how to use that json file again to create or generate the reactlog.

library(shiny)
library(reactlog)
# tell shiny to log all reactivity

reactlog_enable()
reactlogReset()

# run a shiny app
app <- system.file("examples/01_hello", package = "shiny")
runApp(app)

# once app has closed, display reactlog from shiny
shiny::reactlogShow()
reactlog_write(reactlog(),file = "test1.json")

image


How to use this file test1.json to produce the interative reactlog again ?

Activity

  1. schloerke commented on Sep 29, 2020

    @schloerke
    Collaborator

    Dang. Attributes are lost when saving to regular json. 😞

    For now...

    ### add elements to reactlog
    library(shiny)
    library(reactlog)
    # tell shiny to log all reactivity
    
    reactlog_enable()
    reactlogReset()
    
    # run a shiny app
    app <- system.file("examples/01_hello", package = "shiny")
    runApp(app)
    ###
    
    # save to disk
    writeLines(jsonlite::serializeJSON(shiny::reactlog()), file = "test2.json")
    
    # ---------
    
    # restore reactlog to an object
    my_reactlog <- jsonlite::unserializeJSON(readLines("test2.json")[1])
    
    # view reactlog object
    reactlog::reactlog_show(my_reactlog)
  2. changed the title [-]Download the interactive reactlog[/-] [+]`reactlog_write()` output can not be used after being read back[/+] on Sep 29, 2020
  3. added this to the v1.2.0 milestone on Sep 29, 2020
  4. schloerke commented on Oct 7, 2020

    @schloerke
    Collaborator

    Your browser can store the webpage as a "web archive". The html is not a standalone file. For the readme, I have to copy over the assets to make the images / css / js work.

    (For context, I am aware that it would be very nice if it was an htmlwidget to be able to easily include it in other locations.)

  5. royfrancis commented on May 2, 2024

    @royfrancis

    Any updates here? Would it be possible to include a reactlog output in a quarto document?

  6. added a commit that references this issue on Oct 22, 2026
    2935041
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions