Skip to content

fix 'undefined is not iterable' when printing json output #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

beerose
Copy link

@beerose beerose commented Oct 20, 2023

currently running analyze-trace with --json flag results in:

Internal Error: undefined is not iterable (cannot read property Symbol(Symbol.iterator))\nTypeError: undefined is not iterable

(getHotSpotsWorker can return undefined in some cases)

@@ -111,7 +111,7 @@ async function getHotSpotsWorker(curr: EventSpan, currentFile: string | undefine
// Sort slow to fast
const sortedChildren = curr.children.sort((a, b) => (b.end - b.start) - (a.end - a.start));
for (const child of sortedChildren) {
children.push(...await getHotSpotsWorker(child, currentFile, positionMap, relatedTypes, importExpressionThreshold));
children.push(...(await getHotSpotsWorker(child, currentFile, positionMap, relatedTypes, importExpressionThreshold) || []));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be possible; the return type is declared as Promise<HotFrame[]>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants