redirect() function injects "<script>$( document ).ready(function().." into body of bs4Dashh::dashboardPage()
Closed this issue · 4 comments
jjfantini commented
will work on a REPREX to post, still trying to dial down the bug
@ColinFay has been notified
jjfantini commented
pkgload::load_all()
brochure::brochureApp(
reactlog::reactlog_enable(),
# First page
brochure::page(
href = "/",
ui = fluidPage(
h1("This is my first page"),
plotOutput("plot")
),
server = function(input, output, session) {
output$plot <- renderPlot({
plot(iris)
})
}
),
# Second page, without any server-side function
brochure::page(
href = "/page2",
ui = fluidPage(
h1("This is my second page"),
tags$p("There is no server function in this one")
)
)
)
(colin edit: reindent and add markdown formatting)
jjfantini commented
When using reactlog, the redirect function is moved into the body of the document page
ColinFay commented
Smallest reprex possible:
brochure::brochureApp(
"x",
brochure::page(
href = "/"
)
)
The issue is due to how brochureApp()
extract the pages from ...
:
- All the pages (of class
"brochure_page"
) are listed as pages - All the redirect (of class
"brochure_redirect"
) are listed as redirect - All elements that are not of class
"brochure_*"
are injected as is inside the html, so that you can inject your own HTML code.
That's why you can do
brochure::brochureApp(
glouton::use_glouton(),
brochure::page(
href = "/"
)
)
because it returns an html content.
> glouton::use_glouton()
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
<script src="inst/glouton.js"></script>
> class(glouton::use_glouton())
[1] "shiny.tag.list" "list"
reactlog::reactlog_enable()
returns TRUE
, hence the TRUE
is injected as is in your application, or the "x" in this reprex.
My advice is to do the following :
reactlog::reactlog_enable()
brochure::brochureApp(
# First page
brochure::page(
href = "/"
)
)
I'll clarify this in the doc, via #37
jjfantini commented
Seems to have solved the injection issue!! However still showing "Not found" for reactLog after trying to access the endpoint