* Compare children arrays for equality
(a: React.ReactNode, b: React.ReactNode)
| 210 | * Compare children arrays for equality |
| 211 | */ |
| 212 | function childrenEqual(a: React.ReactNode, b: React.ReactNode): boolean { |
| 213 | const aArr = React.Children.toArray(a); |
| 214 | const bArr = React.Children.toArray(b); |
| 215 | |
| 216 | if (aArr.length !== bArr.length) return false; |
| 217 | |
| 218 | for (let i = 0; i < aArr.length; i++) { |
| 219 | const aChild = aArr[i] as ReactElement; |
| 220 | const bChild = bArr[i] as ReactElement; |
| 221 | if (aChild?.key !== bChild?.key) return false; |
| 222 | } |
| 223 | |
| 224 | return true; |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * Synchronize layout with children |
no outgoing calls
no test coverage detected
searching dependent graphs…