Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Commit

Permalink
Issue #887: already defined observer class component warning message … (
Browse files Browse the repository at this point in the history
#888)

* Issue #887: already defined observer class component warning message should get display name from 'target' and not 'this'

* Update changelog
  • Loading branch information
ynejati committed Jul 28, 2020
1 parent 29c1c46 commit 9b8a9e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# MobX-React Changelog

### 6.2.4

- Fix error thrown in the already defined observer class component warning message when attempting to get the components display name. [#887](https://github.com/mobxjs/mobx-react/issues/887)

### 6.2.3

- Log warning if class component is already an observer to prevent memory leaks. [#839](https://github.com/mobxjs/mobx-react/issues/839)
Expand Down
2 changes: 1 addition & 1 deletion src/observerClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function makeClassComponentObserver(
const target = componentClass.prototype

if (componentClass[mobxObserverProperty]) {
const displayName = getDisplayName(this)
const displayName = getDisplayName(target)
console.warn(
`The provided component class (${displayName})
has already been declared as an observer component.`
Expand Down

0 comments on commit 9b8a9e8

Please sign in to comment.