( rootStack: ParsedStackFrame[], hookStack: ParsedStackFrame[], )
| 870 | } |
| 871 | |
| 872 | function findCommonAncestorIndex( |
| 873 | rootStack: ParsedStackFrame[], |
| 874 | hookStack: ParsedStackFrame[], |
| 875 | ) { |
| 876 | let rootIndex = findSharedIndex( |
| 877 | hookStack, |
| 878 | rootStack, |
| 879 | mostLikelyAncestorIndex, |
| 880 | ); |
| 881 | if (rootIndex !== -1) { |
| 882 | return rootIndex; |
| 883 | } |
| 884 | // If the most likely one wasn't a hit, try any other frame to see if it is shared. |
| 885 | // If that takes more than 5 frames, something probably went wrong. |
| 886 | for (let i = 0; i < rootStack.length && i < 5; i++) { |
| 887 | rootIndex = findSharedIndex(hookStack, rootStack, i); |
| 888 | if (rootIndex !== -1) { |
| 889 | mostLikelyAncestorIndex = i; |
| 890 | return rootIndex; |
| 891 | } |
| 892 | } |
| 893 | return -1; |
| 894 | } |
| 895 | |
| 896 | function isReactWrapper(functionName: void | string, wrapperName: string) { |
| 897 | const hookName = parseHookName(functionName); |
no test coverage detected