React-big-calendar: IE11 findDOMNode exception in click selection with multiple routes

Created on 22 Feb 2019  路  5Comments  路  Source: jquense/react-big-calendar

Do you want to request a _feature_ or report a _bug_?

Bug

What's the current behavior?

Environment: IE11 with

  • react-big-calendar 0.20.3
  • moment 0.24.0
  • react 16.8.2
  • react-router 4.3.1
  • react-app-polyfill 0.2.1
  • babel-polyfill 7.2.5
    installed.

Test-URL: https://martin-strobel.github.io/rbc-ie11-bug/dashboard
Test-Repo: https://github.com/martin-strobel/rbc-ie11-bug/

How to reproduce bug:

  1. Open DEV-Console in IE11
  2. Click on a date
  3. Once weekview is visible: Try to select a timeslot or click somewhere else
    This also occurs after switching back to dashboard route.
  4. React shows error "Unable to find node on an unmounted component."

image

This seems to happen because of findDOMNode calls, but I was unable to fix this.
On an unrelated note: Sometimes timeslots are not rendered correctly, this doesn't seem to influence the reported bug.

This trace happened on the calendar (WeekView) page:
image

What's the expected behavior?

There shouldn't be any (uncaught) errors when switching between Routes.

Most helpful comment

It seems that IE incorrectly or not fully unsubscribes from listeners.
I suggest adding isDetached flag to the Selection class.

class Selection {
  constructor(node, { global = false, longPressThreshold = 250 } = {}) {
    this.isDetached = false
    ...
  }

  teardown() {
    this.isDetached = true
    ...
  }

  _handleInitialEvent(e) {
    if (this.isDetached) {
      return
    }
    ...
  }
}

If this approach makes sense, I can create a PR.

All 5 comments

It seems that IE incorrectly or not fully unsubscribes from listeners.
I suggest adding isDetached flag to the Selection class.

class Selection {
  constructor(node, { global = false, longPressThreshold = 250 } = {}) {
    this.isDetached = false
    ...
  }

  teardown() {
    this.isDetached = true
    ...
  }

  _handleInitialEvent(e) {
    if (this.isDetached) {
      return
    }
    ...
  }
}

If this approach makes sense, I can create a PR.

I'm also experiencing this issue, and this change also fixed it for me. @jquense can you confirm that this is a good approach to fixing it, then @DenysZP can make a PR?

Additionally, adding another if (this.isDetached) { return } inside _handleMoveEvent addresses this other error that's coming up: Unable to get property 'x' of undefined or null reference

I got same issues. Please let me know when will this issue be resolved? @jquense

happy to take this PR if it helps

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Beyazatli picture Beyazatli  路  3Comments

zhming0 picture zhming0  路  3Comments

crashspringfield picture crashspringfield  路  4Comments

npalansky picture npalansky  路  3Comments

manutenfruits picture manutenfruits  路  3Comments