( type: any, key: string, forceReset?: boolean = false, getCustomHooks?: () => Array<Function>, )
| 344 | } |
| 345 | |
| 346 | export function setSignature( |
| 347 | type: any, |
| 348 | key: string, |
| 349 | forceReset?: boolean = false, |
| 350 | getCustomHooks?: () => Array<Function>, |
| 351 | ): void { |
| 352 | if (__DEV__) { |
| 353 | if (!allSignaturesByType.has(type)) { |
| 354 | allSignaturesByType.set(type, { |
| 355 | forceReset, |
| 356 | ownKey: key, |
| 357 | fullKey: null, |
| 358 | getCustomHooks: getCustomHooks || (() => []), |
| 359 | }); |
| 360 | } |
| 361 | // Visit inner types because we might not have signed them. |
| 362 | if (typeof type === 'object' && type !== null) { |
| 363 | switch (getProperty(type, '$$typeof')) { |
| 364 | case REACT_FORWARD_REF_TYPE: |
| 365 | setSignature(type.render, key, forceReset, getCustomHooks); |
| 366 | break; |
| 367 | case REACT_MEMO_TYPE: |
| 368 | setSignature(type.type, key, forceReset, getCustomHooks); |
| 369 | break; |
| 370 | } |
| 371 | } |
| 372 | } else { |
| 373 | throw new Error( |
| 374 | 'Unexpected call to React Refresh in a production environment.', |
| 375 | ); |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | // This is lazily called during first render for a type. |
| 380 | // It captures Hook list at that time so inline requires don't break comparisons. |
no test coverage detected