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

colDef with cell parameter fails to render with reactR 0.6.0 #388

Open
edelgado-ecdc opened this issue Aug 6, 2024 · 3 comments
Open

colDef with cell parameter fails to render with reactR 0.6.0 #388

edelgado-ecdc opened this issue Aug 6, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@edelgado-ecdc
Copy link

Dear development team,

Thank you for your effort in maintaining one of the best table options for R!

Recently we started a new project and tried to render a table with HTML entities in it - something we've done a fair amount of times. However, when rendering the table, we found out that it simply wouldn't come up. After checking a few things we managed to identify the problem being ReactR 0.6.0 - when running with React 0.5.0 it works.

You can try this example from the reactable documentation:

library(reactable)
data <- MASS::Cars93[1:5, c("Manufacturer", "Model", "Type", "AirBags", "Price")]

reactable(data, columns = list(
    Model = colDef(cell = function(value, index) {
        # Render as a link
        url <- sprintf("https://wikipedia.org/wiki/%s_%s", data[index, "Manufacturer"], value)
        htmltools::tags$a(href = url, target = "_blank", as.character(value))
    }),
    AirBags = colDef(cell = function(value) {
        # Render as an X mark or check mark
        if (value == "None") "\u274c No" else "\u2714\ufe0f Yes"
    }),
    Price = colDef(cell = function(value) {
        # Render as currency
        paste0("$", format(value * 1000, big.mark = ","))
    })
))

Judging at the ReactR changelog there might be a couple of breaking changes with how it handles tags.

I couldn't find any recommendation on the version of reactR to use, but perhaps in the meantime it would be good to limit the version to 0.5.0.

Again, thanks for your effort on this library! :)

@glin glin added the bug Something isn't working label Aug 12, 2024
@glin
Copy link
Owner

glin commented Aug 12, 2024

Yep, this is an issue with reactR 0.6.0. Pin to reactR 0.5.0 until it's fixed in reactR.

There was some discussion at #363 (comment), but this is a more specifically titled issue, so I'll pin this one.

The reactR issue is react-R/reactR#86, so you can subscribe to that for updates.

@azimov
Copy link

azimov commented Sep 10, 2024

I am experiencing this issue with reactR but only on posit connect hosted platforms, not on mac or windows

@glin
Copy link
Owner

glin commented Sep 11, 2024

@azimov Yes, the bug affects Posit Connect as well, so you can install the older reactR 0.5.0 for now.

As a general update, I also dug into the bug a bit and suggested a fix at react-R/reactR#89

One more workaround option would be to install the patch from my reactR fork via remotes::install_github("glin/reactR"), but you might prefer using the reactR 0.5.0 version on CRAN still.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants