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

Cannot read properties of null (reading 'setRoot') #661

Closed
grassick opened this issue Dec 2, 2022 · 4 comments
Closed

Cannot read properties of null (reading 'setRoot') #661

grassick opened this issue Dec 2, 2022 · 4 comments
Assignees
Labels
bug regression issue that was "fixed" but got reopened later on

Comments

@grassick
Copy link
Contributor

grassick commented Dec 2, 2022

Expected Behavior

Table should not cause exception when being unmounted

Current Behavior

Table sometimes (and I mean sometimes, seems to be a difficult to reproduce race condition) throws exception Cannot read properties of null (reading 'setRoot') in FixedDataTable in the _onRef function, as _wheelHandler is already null by the time it's called. This is because of componentWillUnmount being called before the div is de-refed.

Possible Solution

Check that this._wheelHandler isn't null

Steps to Reproduce (for bugs)

I really wish I could. It's been working fine for years in our code and just started blowing up today. I can't even get it to happen consistently on a repo.

Context

It makes our product crash. It's bad.

Your Environment

  • Version used: 1.2.13
  • Browser Name and version: Chrome Version 107.0.5304.121 (Official Build) (64-bit)
  • Operating System and version (desktop or mobile): Linux
  • Link to your project: N/A
grassick added a commit to mWater/fixed-data-table-2 that referenced this issue Dec 2, 2022
@grassick grassick mentioned this issue Dec 2, 2022
@pradeepnschrodinger pradeepnschrodinger added bug regression issue that was "fixed" but got reopened later on labels Dec 3, 2022
@pradeepnschrodinger
Copy link
Collaborator

Thanks for brining the issue to our attention.

The NPE seen here comes from the changes made by #657 that I merged a couple of days back, which was (ironically) meant to fix a similar NPE.
I can reproduce the error consistently by mounting and then unmounting the table.

I'll take a look at the PR, thanks!

@pradeepnschrodinger pradeepnschrodinger self-assigned this Dec 3, 2022
@pradeepnschrodinger
Copy link
Collaborator

The NPE seen here comes from the changes made by #657 that I merged a couple of days back

Nvm, this is only partially true. The issue always existed before #657, although it was only seen when stopReactWheelPropagation is set to true.
#657 has just brought the error up consistently on unmounting regardless of the value for stopReactWheelPropagation.

@grassick grassick mentioned this issue Dec 3, 2022
grassick added a commit to mWater/fixed-data-table-2 that referenced this issue Dec 3, 2022
@grassick grassick mentioned this issue Dec 3, 2022
pradeepnschrodinger pushed a commit that referenced this issue Dec 3, 2022
React runs `componentWillUnmount` prior to resetting refs through ref callbacks.

This caused a NPE in our ref callback since it attempted to use `_wheelHandler` which had already gotten cleaned up in `componentWillUnmount`.
Fixed with a simple null guard check against _wheelHandler.
@pradeepnschrodinger
Copy link
Collaborator

The fix for this is available on v1.2.14, through #664.

@pradeepnschrodinger
Copy link
Collaborator

I'm closing this off since the issue is resolved, but feel free to comment/reopen if you need any help or have any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug regression issue that was "fixed" but got reopened later on
Projects
None yet
Development

No branches or pull requests

2 participants