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

DT 0.31 breaks previous 'ignore colnames' behavior during replaceData() #1108

Closed
3 tasks done
mmuurr opened this issue Dec 25, 2023 · 1 comment
Closed
3 tasks done
Labels

Comments

@mmuurr
Copy link

mmuurr commented Dec 25, 2023

I've confirmed commit b42dd91 (part of v0.31) causes a breaking change.

In previous versions, when pushing data to a DT via replaceData(), only column order was used (i.e. colnames were ignored).
With b42dd91, colnames are now required (assuming the original 'shell' table being proxied has colnames) and replaceData() calls now fail when any expected colname is missing, triggering a window.alert() on the client.

Perhaps matching on colnames is a perfectly fine API change, but neither the release notes nor the replaceData() docs highlight this change as a new requirement (i.e. a breaking change). I suspect many applications (like some of mine :-)) will fail surprisingly after the DT update.

The below works with 8f6bfd1 but fails with b42dd91.

library(shiny)
library(DT)

UI <- fluidPage(dataTableOutput("the-table"))

SERVER <- function(input, output, session) {

  output[["the-table"]] <- renderDataTable({
    datatable(
      data = iris[0,],
      rownames = FALSE
    )
  })

  dt_proxy <- dataTableProxy("the-table")

  observe({
    replaceData(dt_proxy, unname(iris), rownames = FALSE)  ## `unname` to trigger the (FE) error
  })
}

runApp(shinyApp(UI, SERVER))

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('DT'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/DT').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@yihui yihui added the bug label Dec 30, 2023
@yihui yihui closed this as completed in 33b7642 Jan 18, 2024
@yihui
Copy link
Member

yihui commented Jan 18, 2024

Sorry about that! It's indeed a bug that I failed to realize. Should be fixed now.

You can install the development version via

remotes::install_github('rstudio/DT')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

2 participants