( finishedWork: Fiber, current: Fiber | null, commitStartTime: number, effectDuration: number, )
| 933 | } |
| 934 | |
| 935 | function commitProfiler( |
| 936 | finishedWork: Fiber, |
| 937 | current: Fiber | null, |
| 938 | commitStartTime: number, |
| 939 | effectDuration: number, |
| 940 | ) { |
| 941 | const {id, onCommit, onRender} = (finishedWork.memoizedProps: ProfilerProps); |
| 942 | |
| 943 | let phase: ProfilerPhase = current === null ? 'mount' : 'update'; |
| 944 | if (enableProfilerNestedUpdatePhase) { |
| 945 | if (isCurrentUpdateNested()) { |
| 946 | phase = 'nested-update'; |
| 947 | } |
| 948 | } |
| 949 | |
| 950 | if (typeof onRender === 'function') { |
| 951 | onRender( |
| 952 | id, |
| 953 | phase, |
| 954 | // $FlowFixMe: This should be always a number in profiling mode |
| 955 | finishedWork.actualDuration, |
| 956 | // $FlowFixMe: This should be always a number in profiling mode |
| 957 | finishedWork.treeBaseDuration, |
| 958 | // $FlowFixMe: This should be always a number in profiling mode |
| 959 | finishedWork.actualStartTime, |
| 960 | commitStartTime, |
| 961 | ); |
| 962 | } |
| 963 | |
| 964 | if (enableProfilerCommitHooks) { |
| 965 | if (typeof onCommit === 'function') { |
| 966 | onCommit(id, phase, effectDuration, commitStartTime); |
| 967 | } |
| 968 | } |
| 969 | } |
| 970 | |
| 971 | export function commitProfilerUpdate( |
| 972 | finishedWork: Fiber, |
no test coverage detected