Skip to content

fix(devtools): correct V8 stack regex when source path contains spaces#3531

Open
Copilot wants to merge 1 commit into
mainfrom
copilot/address-discussion-3530
Open

fix(devtools): correct V8 stack regex when source path contains spaces#3531
Copilot wants to merge 1 commit into
mainfrom
copilot/address-discussion-3530

Conversation

Copilot AI commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Related Bug Reports or Discussions

Summary

The V8 stack frame regex /.+ (.+) .+/ used greedy matching, causing it to capture part of the source path instead of the function name whenever the path contained a space. This corrupted the action label shown in Redux DevTools — purely cosmetic, but consistently wrong.

Affected patterns:

  • Webpack namespaces: at Object.increment (webpack://my app/./src/store.js:10:5) → was "(webpack://my", should be "Object.increment"
  • Windows paths: at increment (C:\Program Files\app\store.js:10:5) → was "(C:\Program", should be "increment"

Fix — anchor to at, use a lazy quantifier, stop at (:

- const v8StackLineRe = /.+ (.+) .+/
+ const v8StackLineRe = /^at (.+?) \(/

Adds three parameterized regression tests covering the webpack-namespace case, the Windows-path case, and a space-free path guard.

Check List

  • pnpm run fix for formatting and linting code and docs

Fixes the greedy regex `/.+ (.+) .+/` which would incorrectly capture
text when the caller's source path contains a space (e.g. webpack
namespaces like `webpack://my app/...` or Windows paths under
`C:\Program Files\...`).

Replace with `/^at (.+?) \(/` which anchors at `at `, uses a lazy
quantifier, and stops at the first ` (` — the boundary between the
function name and the source location in a V8 stack frame.

Adds deterministic regression tests for:
- webpack namespace with a space in the path
- Windows path with a space in the path
- space-free path (regression guard)

Closes #3530
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zustand-demo Ready Ready Preview, Comment Jun 22, 2026 6:32am

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Jun 22, 2026

Copy link
Copy Markdown

commit: 0d90656

@github-actions

Copy link
Copy Markdown

Size Change: +2 B (+0.02%)

Total Size: 13.1 kB

📦 View Changed
Filename Size Change
dist/esm/middleware.mjs 4.1 kB +1 B (+0.02%)
dist/middleware.js 4.11 kB +1 B (+0.02%)
ℹ️ View Unchanged
Filename Size
dist/esm/index.mjs 64 B
dist/esm/middleware/immer.mjs 212 B
dist/esm/react.mjs 342 B
dist/esm/react/shallow.mjs 198 B
dist/esm/shallow.mjs 82 B
dist/esm/traditional.mjs 412 B
dist/esm/vanilla.mjs 405 B
dist/esm/vanilla/shallow.mjs 557 B
dist/index.js 244 B
dist/middleware/immer.js 231 B
dist/react.js 357 B
dist/react/shallow.js 213 B
dist/shallow.js 189 B
dist/traditional.js 426 B
dist/vanilla.js 418 B
dist/vanilla/shallow.js 568 B

compressed-size-action

@dai-shi dai-shi marked this pull request as ready for review June 22, 2026 06:35
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