(contextMap: Map<ReactContext<any>, any>, fiber: Fiber)
| 1230 | } |
| 1231 | |
| 1232 | function setupContexts(contextMap: Map<ReactContext<any>, any>, fiber: Fiber) { |
| 1233 | let current: null | Fiber = fiber; |
| 1234 | while (current) { |
| 1235 | if (current.tag === ContextProvider) { |
| 1236 | let context: ReactContext<any> = current.type; |
| 1237 | if ((context: any)._context !== undefined) { |
| 1238 | // Support inspection of pre-19+ providers. |
| 1239 | context = (context: any)._context; |
| 1240 | } |
| 1241 | if (!contextMap.has(context)) { |
| 1242 | // Store the current value that we're going to restore later. |
| 1243 | contextMap.set(context, context._currentValue); |
| 1244 | // Set the inner most provider value on the context. |
| 1245 | context._currentValue = current.memoizedProps.value; |
| 1246 | } |
| 1247 | } |
| 1248 | current = current.return; |
| 1249 | } |
| 1250 | } |
| 1251 | |
| 1252 | function restoreContexts(contextMap: Map<ReactContext<any>, any>) { |
| 1253 | contextMap.forEach((value, context) => (context._currentValue = value)); |
no test coverage detected