Skip to content

[Bug]: App crashes when trying to sort by multiple columns (Shift+click) #70

@katjur01

Description

@katjur01

Guidelines

  • I agree to follow this project's Contributing Guidelines.

Project Version

No response

Platform and OS Version

No response

Existing Issues

No response

What happened?

When using reactable.extras in a Shiny app, sorting by a single column in UI works correctly. However, when attempting to sort by multiple columns using Shift-click, the app throws the following error:

Warning: Error in rlang::sym: Can't convert a character vector to a symbol.
  55: <Anonymous>
  54: signalCondition
  53: signal_abort
  52: abort
  51: abort_coercion
  50: rlang::sym
  49: ::
shiny
observe
  48: <observer>
   1: runApp

Steps to reproduce

  1. Run a Shiny app with reactable_extras_server displaying any simple data frame.
  2. Click on a column header (e.g., column1) to sort.
  3. Hold the Shift key and click on a second column header (e.g., column2) to add it to the sort.
  4. The app immediately crashes with: Error in rlang::sym: Can't convert a character vector to a symbol.

Using defaultSorted with multiple columns:

  1. In your reactable_extras_server call, add: defaultSorted = list("column1" = "desc", "column2" = "desc")
  2. Run the Shiny app.
  3. The app immediately crashes on startup with: Error in rlang::sym: Can't convert a character vector to a symbol.

Expected behavior

Shift-clicking to sort by multiple columns should work as it does in reactable, allowing the table to sort by multiple columns without errors.

Attachments

library(shiny)
library(reactable.extras)
library(data.table)

ui <- fluidPage(
  reactable_extras_ui("table")
)

server <- function(input, output, session) {
  data <- data.table(
    column1 = sample(letters, 100, TRUE),
    column2 = sample(LETTERS, 100, TRUE),
    column3 = rnorm(100)
  )
  
  reactable_extras_server(
    "table",
    data = data,
    filterable = TRUE,
    sortable = TRUE
    # Same error if you add:
    # defaultSorted = list("column1" = "desc", "column2" = "desc")
  )
}

shinyApp(ui, server)

Screenshots or Videos

No response

Additional Information

The same error occurs when defining the reactable parameter defaultSorted with more than one column, for example:
defaultSorted = list("column1" = "desc", "column2" = "desc")
This setup immediately triggers the same rlang::sym error on app startup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions