Repository navigation
Commit bf7b7ae
authored
findDOMNode: Remove return pointer mutation (#20272)
The last step of the `findDOMNode` algorithm is a search of the
current tree.
When descending into a child node, it mutates `child.return` so that it
points to the current fiber pair, instead of a work-in-progress. This
can cause bugs if `findDOMNode` is called at the wrong time, like in
an interleaved event.
For this reason (among others), you're not suppposed to use
`findDOMNode` in Concurrent Mode. However, we still have some internal
uses that we haven't migrated.
To reduce the potential for bugs, I've removed the `.return` pointer
assignment in favor of recursion.1 parent 369c3db commit bf7b7ae
1 file changed
Lines changed: 37 additions & 51 deletions
Lines changed: 37 additions & 51 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
269 | | - | |
270 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
271 | 272 | | |
| 273 | + | |
272 | 274 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
290 | 284 | | |
291 | | - | |
292 | | - | |
| 285 | + | |
293 | 286 | | |
294 | | - | |
295 | | - | |
| 287 | + | |
296 | 288 | | |
297 | 289 | | |
298 | 290 | | |
299 | 291 | | |
300 | 292 | | |
301 | | - | |
302 | | - | |
303 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
304 | 297 | | |
| 298 | + | |
305 | 299 | | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
325 | 314 | | |
326 | | - | |
327 | 315 | | |
328 | | - | |
329 | | - | |
| 316 | + | |
330 | 317 | | |
331 | | - | |
332 | | - | |
| 318 | + | |
333 | 319 | | |
334 | 320 | | |
335 | 321 | | |
| |||
0 commit comments