Skip to content

Commit

Permalink
@uppy/informer: add a check in TransitionGroup when component is nu…
Browse files Browse the repository at this point in the history
…ll (#4410)

Add a check in case component is null

Co-authored-by: Juan Belej <[email protected]>
  • Loading branch information
jbelej and Juan Belej committed Apr 11, 2023
1 parent 7adacb7 commit f84ba51
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/@uppy/informer/src/TransitionGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class TransitionGroup extends Component {

const component = this.refs[key]

if (component.componentWillAppear) {
if (component?.componentWillAppear) {
component.componentWillAppear(this._handleDoneAppearing.bind(this, key))
} else {
this._handleDoneAppearing(key)
Expand All @@ -168,7 +168,7 @@ class TransitionGroup extends Component {

_handleDoneAppearing (key) {
const component = this.refs[key]
if (component.componentDidAppear) {
if (component?.componentDidAppear) {
component.componentDidAppear()
}

Expand All @@ -188,7 +188,7 @@ class TransitionGroup extends Component {

const component = this.refs[key]

if (component.componentWillEnter) {
if (component?.componentWillEnter) {
component.componentWillEnter(this._handleDoneEntering.bind(this, key))
} else {
this._handleDoneEntering(key)
Expand All @@ -197,7 +197,7 @@ class TransitionGroup extends Component {

_handleDoneEntering (key) {
const component = this.refs[key]
if (component.componentDidEnter) {
if (component?.componentDidEnter) {
component.componentDidEnter()
}

Expand All @@ -223,7 +223,7 @@ class TransitionGroup extends Component {
this.currentlyTransitioningKeys[key] = true

const component = this.refs[key]
if (component.componentWillLeave) {
if (component?.componentWillLeave) {
component.componentWillLeave(this._handleDoneLeaving.bind(this, key))
} else {
// Note that this is somewhat dangerous b/c it calls setState()
Expand All @@ -243,7 +243,7 @@ class TransitionGroup extends Component {

const component = this.refs[key]

if (component.componentDidLeave) {
if (component?.componentDidLeave) {
component.componentDidLeave()
}

Expand Down

0 comments on commit f84ba51

Please sign in to comment.