Commit 8b141e4
committed
fix(refUpdates): Adds defensive check to 'unobserve' method
On updates (re-rendering) there are cases where the ref callback gets called twice: first
to nullify the DOM node and again when setting the new DOM node. ReactDOM.createPortal()
for example causes this when it's re-rendered, causing an exception when we call
unobserve() on a null node. Future updates should change the way we handle refs to a more
solid solution.1 parent 2bbec6c commit 8b141e4
File tree
2 files changed
+19
-1
lines changed- src
- __tests__
2 files changed
+19
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
139 | 141 | | |
140 | 142 | | |
141 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
239 | 255 | | |
240 | 256 | | |
241 | 257 | | |
| |||
0 commit comments