Skip to content

Commit 8bd09d1

Browse files
committed
perf: Ensure visited types memory is empty after flow type detection is done
1 parent 033cda6 commit 8bd09d1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/utils/getFlowType.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ function getFlowTypeWithResolvedTypes(path: NodePath): FlowTypeDescriptor {
293293
* If there is no match, "unknown" is returned.
294294
*/
295295
export default function getFlowType(path: NodePath): FlowTypeDescriptor {
296+
// Empty visited types before an after run
297+
// Before: in case the detection threw and we rerun again
298+
// After: cleanup memory after we are done here
296299
visitedTypes = {};
297-
return getFlowTypeWithResolvedTypes(path);
300+
const type = getFlowTypeWithResolvedTypes(path);
301+
visitedTypes = {};
302+
303+
return type;
298304
}

0 commit comments

Comments
 (0)