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: Edit Programmatic all row cannot read properties of undefined (reading 'data') #3783

Closed
Jadiction opened this issue Dec 14, 2022 · 9 comments · Fixed by #3785
Closed
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@Jadiction
Copy link

Jadiction commented Dec 14, 2022

Describe the bug

Editing cells in DataTables with editMode set to "cell" can produce errors from the onChange editorCallback. I can reliably produce this when trying to edit several cells in a quick manner, and I'm guessing it happens when trying to type characters before/while clicking the cell to edit. For example, the error will arise if I hold a character like "g" and click around cells.
Below is an example of the error from my reproducer. This is the datatables documentation example from https://www.primefaces.org/primereact/datatable/edit/

image

Reproducer

https://codesandbox.io/s/primereact-test-forked-vhcvsm

PrimeReact version

8.7.2

React version

18.x

Language

ALL

Build / Runtime

Next.js

Browser(s)

Chrome 108

Steps to reproduce the behavior

  1. Load reproducer example
  2. Click on the right side and hold a letter on your keyboard such as "g."
  3. Click around the editable cells
    - For example, in the top table, you can click between the Code column cells f230fh0g3 and nvklal433 until it errors.
@Jadiction Jadiction added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 14, 2022
@melloware melloware changed the title Component: DataTable DataTable: Edit Programmatic all row cannot read properties of undefined (reading 'data') Dec 14, 2022
@melloware
Copy link
Member

@Jadiction great reproducer I could reproduce it on 8.7.2. But I couldn't using 8.7.3 can you try my reproducer?

https://codesandbox.io/s/primereact-test-forked-hcli3o?file=/src/index.js

@Jadiction
Copy link
Author

@melloware Thanks for the quick reply. I was able to reproduce it on your reproducer using 8.7.3 as well -

image

@melloware
Copy link
Member

OK maybe I am not clicking fast enough. Looks like this is similar to this issue #3013

@Jadiction
Copy link
Author

To reproduce it, I'll hold a key and switch between the first few cells and it usually comes up pretty quickly. I've had this error in my project randomly without intentionally breaking it too, this is just the best way I know I can re-recreate it.
You're right, same error as #3013, I'm sure they're related and would be fixed together.

@melloware
Copy link
Member

OK I "think" I have a fix.

@Jadiction
Copy link
Author

That would be great. I'll be happy to do any testing.

@melloware
Copy link
Member

OK submitted PR. I at least stopped the horrible error. :)

@melloware melloware self-assigned this Dec 14, 2022
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Dec 14, 2022
@melloware melloware added this to the 8.7.4 milestone Dec 14, 2022
@Jadiction
Copy link
Author

I pushed the latest update to my reproducer and was still able to reproduce the error. Maybe there's some caching somewhere that I'm missing.

@melloware
Copy link
Member

melloware commented Dec 14, 2022

how did you push the latest up? This code will go in 8.7.4 which has not been released yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants