Skip to content

fix: handle incomplete stack frames in error overview#965

Merged
sindresorhus merged 2 commits into
vadimdemedes:masterfrom
cyphercodes:fix/error-overview-stack-frames
May 29, 2026
Merged

fix: handle incomplete stack frames in error overview#965
sindresorhus merged 2 commits into
vadimdemedes:masterfrom
cyphercodes:fix/error-overview-stack-frames

Conversation

@cyphercodes

Copy link
Copy Markdown
Contributor

Summary

  • Render stack-utils incomplete stack frames (for example at native) as raw stack lines instead of structured frames with undefined fields.
  • Give repeated stack lines unique, stable keys so trailing/empty stack lines do not trigger React duplicate-key warnings.
  • Add focused ErrorOverview regression coverage for native frames and repeated blank stack lines.

Closes #963

Test Plan

  • FORCE_COLOR=true npx ava test/error-overview.tsx --serial
  • FORCE_COLOR=true npx ava test/errors.tsx test/error-overview.tsx --serial
  • npm run typecheck
  • npm run lint (passes with existing warnings in unrelated files)
  • npm run build
  • git diff --check

Note: I also ran npm test; it reached the broad AVA suite but failed in unrelated existing tests (alternate-screen-example, cursor, and measure-element) outside the touched ErrorOverview surface.

@sindresorhus

Copy link
Copy Markdown
Collaborator

This still misses named native frames. I manually checked parseLine(' at foo (native)'), and it returns {native: true, function: 'foo'}. Since function is present, the new guard takes the structured frame path even though there is no file, line, or column.

Rendering that stack line currently produces - foo (::), and the aria label includes line undefined column undefined.

I think the guard should treat frames without source location data as incomplete too, not just frames where both file and function are missing. Otherwise this fix covers at native, but not at foo (native).

@cyphercodes

Copy link
Copy Markdown
Contributor Author

Updated this PR to handle named native frames like at foo (native) as incomplete stack frames too, so they render as the original raw stack line instead of foo (::) / undefined source-location metadata.

Local verification:

  • npm run typecheck
  • npx xo src/components/ErrorOverview.tsx test/error-overview.tsx
  • FORCE_COLOR=true npx ava test/error-overview.tsx
  • git diff --check

@sindresorhus sindresorhus merged commit b2350c1 into vadimdemedes:master May 29, 2026
2 checks passed
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.

ErrorOverview: duplicate keys on empty stack lines + incomplete parseLine guard for native frames

2 participants