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

DataTable: onValueChange fires if the selection if updated #5281

Closed
JaredHammond opened this issue Nov 10, 2023 · 2 comments · Fixed by #5282
Closed

DataTable: onValueChange fires if the selection if updated #5281

JaredHammond opened this issue Nov 10, 2023 · 2 comments · Fixed by #5282
Assignees
Labels
Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted
Milestone

Comments

@JaredHammond
Copy link

JaredHammond commented Nov 10, 2023

Describe the bug

Since 10.0.x, onValueChange callback runs when the selected rows changes. Within my application, this is causing an infinite loop issue. According to DataTable api docs, onValueChange is "Callback to invoke after filtering and sorting to pass the rendered value."

Reproducer

https://codesandbox.io/p/sandbox/onvaluechange-infiniteloop-forked-7p94pj

PrimeReact version

10.0.x

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA) and Next.js 13.2.1 using pages router.

Browser(s)

No response

Steps to reproduce the behavior

  1. Go to reproducer codesandbox.
  2. Open console
  3. Select row, see that onValueChange callback fires.
  4. Bonus: Uncomment line 117 and cause inifinte loop.

Expected behavior

I expect onValueChange to only run if sorting or filtering happens. This behaves as expected in v9.6.0.

Same codesandbox as the reproducer, but with [email protected].

https://codesandbox.io/p/sandbox/onvaluechange-noinfiniteloop-gqq683

@JaredHammond JaredHammond added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 10, 2023
@melloware
Copy link
Member

Duplicate of #5160 ???

@melloware melloware added Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 10, 2023
melloware added a commit to melloware/primereact that referenced this issue Nov 10, 2023
@melloware melloware added this to the 10.0.10 milestone Nov 10, 2023
@melloware melloware self-assigned this Nov 10, 2023
@JaredHammond
Copy link
Author

Thanks! I thought it was likely a dupe, but hoped the reproducer might be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants