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

Fix getFacetedMinMaxValues #5676

Merged
merged 4 commits into from
Aug 3, 2024
Merged

Conversation

vincerubinetti
Copy link
Contributor

I noticed a bug in getFacetedMinMaxValues that I'm surprised no one else has reported or the type checks haven't flagged. Actually, I'm sure I've run into this issue before, but I guess I never got around to reporting it...

The getUniqueValues function says it returns (and in testing, does return) an array of values. Thus, firstValue becomes e.g. [123], and facetedMinMaxValues will get initialized to [[123], [123]], which sometimes results in the function returning e.g. [123, [123]], depending on the row values. I'm guessing people don't always notice a bug here because an array is being </> compared to a numbe, which I think coerces the array to a string?

My first commit makes the minimal change that I think fixes the issue. The second commit reworks the function to be a bit safer imo.

Copy link

nx-cloud bot commented Jul 29, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit dbaaa72. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.


for (let j = 0; j < values.length; j++) {
const value = values[j]!
let facetedMinValue = uniqueValues.at(0)!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to only use es2020 syntax here

Copy link

pkg-pr-new bot commented Aug 3, 2024

commit: dbaaa72

pnpm add https://pkg.pr.new/@tanstack/angular-table@5676
pnpm add https://pkg.pr.new/@tanstack/lit-table@5676
pnpm add https://pkg.pr.new/@tanstack/match-sorter-utils@5676
pnpm add https://pkg.pr.new/@tanstack/qwik-table@5676
pnpm add https://pkg.pr.new/@tanstack/react-table@5676
pnpm add https://pkg.pr.new/@tanstack/react-table-devtools@5676
pnpm add https://pkg.pr.new/@tanstack/solid-table@5676
pnpm add https://pkg.pr.new/@tanstack/svelte-table@5676
pnpm add https://pkg.pr.new/@tanstack/table-core@5676
pnpm add https://pkg.pr.new/@tanstack/vue-table@5676

Open in Stackblitz

More templates

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

Successfully merging this pull request may close these issues.

2 participants