File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
# MobX-React Changelog
2
2
3
+ ### 4.1.3
4
+
5
+ * Fixed ` ReactDOM.findDOMNode ` exception when using react-test-runner, #216
6
+
3
7
### 4.1.2
4
8
5
9
* Exceptions caught during render are now rethrown with proper stack, fixes #206
Original file line number Diff line number Diff line change @@ -18,8 +18,16 @@ export const componentByNodeRegistery = typeof WeakMap !== "undefined" ? new Wea
18
18
export const renderReporter = new EventEmitter ( ) ;
19
19
20
20
function findDOMNode ( component ) {
21
- if ( ReactDOM )
22
- return ReactDOM . findDOMNode ( component ) ;
21
+ if ( ReactDOM ) {
22
+ try {
23
+ return ReactDOM . findDOMNode ( component ) ;
24
+ } catch ( e ) {
25
+ // findDOMNode will throw in react-test-renderer, see:
26
+ // See https://github.com/mobxjs/mobx-react/issues/216
27
+ // Is there a better heuristic?
28
+ return null ;
29
+ }
30
+ }
23
31
return null ;
24
32
}
25
33
You can’t perform that action at this time.
0 commit comments