( Component: any, props: any, children: any, refOrContext: any, )
| 241 | } |
| 242 | |
| 243 | export function finishHooks( |
| 244 | Component: any, |
| 245 | props: any, |
| 246 | children: any, |
| 247 | refOrContext: any, |
| 248 | ): any { |
| 249 | // This must be called after every function component to prevent hooks from |
| 250 | // being used in classes. |
| 251 | |
| 252 | while (didScheduleRenderPhaseUpdate) { |
| 253 | // Updates were scheduled during the render phase. They are stored in |
| 254 | // the `renderPhaseUpdates` map. Call the component again, reusing the |
| 255 | // work-in-progress hooks and applying the additional updates on top. Keep |
| 256 | // restarting until no more updates are scheduled. |
| 257 | didScheduleRenderPhaseUpdate = false; |
| 258 | localIdCounter = 0; |
| 259 | actionStateCounter = 0; |
| 260 | actionStateMatchingIndex = -1; |
| 261 | thenableIndexCounter = 0; |
| 262 | numberOfReRenders += 1; |
| 263 | |
| 264 | // Start over from the beginning of the list |
| 265 | workInProgressHook = null; |
| 266 | |
| 267 | children = Component(props, refOrContext); |
| 268 | } |
| 269 | |
| 270 | resetHooksState(); |
| 271 | return children; |
| 272 | } |
| 273 | |
| 274 | export function getThenableStateAfterSuspending(): null | ThenableState { |
| 275 | const state = thenableState; |
no test coverage detected