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

React implementation bug for swap rows #1469

Closed
twharmon opened this issue Oct 26, 2023 · 2 comments
Closed

React implementation bug for swap rows #1469

twharmon opened this issue Oct 26, 2023 · 2 comments

Comments

@twharmon
Copy link
Contributor

twharmon commented Oct 26, 2023

STR:

  • create 1k rows
  • delete one row only
  • swap rows

The screen will go blank and/or you will see an error message in the console:

TypeError: Cannot read properties of undefined (reading 'id')

This is probably caused in these lines:

if (data.length > 998) {
  return this.setState({ data: [data[0], data[998], ...data.slice(2, 998), data[1], data[999]] });
}

It is trying to index on 999 when there may only be 999 items in the array.

This error is not encountered when the benchmark is ran.

@twharmon twharmon changed the title React bug for swap rows React implementation bug for swap rows Oct 26, 2023
@krausest
Copy link
Owner

Yeah, but the spread operator is way cooler 😄
I fixed all react implementations. Interesting to see how often the faulty code was copied.

@krausest
Copy link
Owner

Screenshot 2023-10-31 at 7 46 35 PM
As expected results did not change for the implementations for most react implementations.
I don't understand the reason why, but react-redux and react-redux-rematch got slower in this run, for example for create rows (so it hardly can be due to this change). I tried multiple runs, but consistently got around 60 msecs (i.e. much higher than the 55 msecs before).
I'm not sure if there was a minor chrome update in between and whether the OS Update to 14.1 happened in between.

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

No branches or pull requests

2 participants