Skip to content

[Bug Report][3.8.0] VDataTableHeader custom filtering not working #21212

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

Closed
rudashi opened this issue Apr 4, 2025 · 2 comments
Closed

[Bug Report][3.8.0] VDataTableHeader custom filtering not working #21212

rudashi opened this issue Apr 4, 2025 · 2 comments
Assignees
Labels
C: VDataTable T: bug Functionality that does not work as intended/expected
Milestone

Comments

@rudashi
Copy link

rudashi commented Apr 4, 2025

Environment

Vuetify Version: 3.8.0
Vue Version: 3.5.13
Browsers: Edge 134.0.0.0
OS: Mac OS 10.15.7

Steps to reproduce

  1. Open playground
  2. See console log

Expected Behavior

filter column by header

Actual Behavior

Crashing app

Image

Reproduction Link

https://play.vuetifyjs.com/#...

@KaelWD KaelWD added T: bug Functionality that does not work as intended/expected C: VDataTable labels Apr 4, 2025
@github-actions github-actions bot removed the S: triage label Apr 4, 2025
@modos
Copy link

modos commented Apr 6, 2025

i don't know why but it keeps crashing until remove filter function defined in tableHeaders array

@Redpoint1
Copy link

Redpoint1 commented Apr 7, 2025

Found it:
https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/composables/filter.tsx#L48

export const defaultFilter: FilterFunction = (value, query, item) => {
  if (value == null || query == null) return -1

  value = value.toString().toLocaleLowerCase()
  query = query.toString().toLocaleLowerCase()

  const result = []

  let idx = value.indexOf(query)
  while (~idx) {
    result.push([idx, idx + query.length] as const)

    idx = value.indexOf(query, idx + query.length)
  }

The query is an empty string and not null, causing an infinite loop here

// value.indexOf("", 0 + 0) 
idx = value.indexOf(query, idx + query.length)

The function has changed here:
9da6442#diff-3df71dcef30db080ec919186fd82f35bba0ccc01932ada675a01ad776ace1296

@KaelWD KaelWD self-assigned this Apr 8, 2025
@KaelWD KaelWD added this to the v3.8.x milestone Apr 8, 2025
@KaelWD KaelWD closed this as completed in 0a8de9b Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VDataTable T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

No branches or pull requests

4 participants