René's URL Explorer Experiment


Title: devtools-vite: source injection silently yields zero data-tsd-source attributes (AST child-key cache poisoned by regex literals) · Issue #523 · TanStack/devtools · GitHub

Open Graph Title: devtools-vite: source injection silently yields zero data-tsd-source attributes (AST child-key cache poisoned by regex literals) · Issue #523 · TanStack/devtools

X Title: devtools-vite: source injection silently yields zero data-tsd-source attributes (AST child-key cache poisoned by regex literals) · Issue #523 · TanStack/devtools

Description: TanStack Devtools version @tanstack/devtools-vite@0.8.5 transitive @tanstack/devtools-bundler-core@0.1.3 @tanstack/react-devtools@0.10.12 (transitive @tanstack/devtools@0.14.2) Vite 8.2.2, Astro 7.2.9 (Astro drives Vite here; I could not...

Open Graph Description: TanStack Devtools version @tanstack/devtools-vite@0.8.5 transitive @tanstack/devtools-bundler-core@0.1.3 @tanstack/react-devtools@0.10.12 (transitive @tanstack/devtools@0.14.2) Vite 8.2.2, Astro 7....

X Description: TanStack Devtools version @tanstack/devtools-vite@0.8.5 transitive @tanstack/devtools-bundler-core@0.1.3 @tanstack/react-devtools@0.10.12 (transitive @tanstack/devtools@0.14.2) Vite 8.2.2, Astro 7....

Opengraph URL: https://github.com/TanStack/devtools/issues/523

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"devtools-vite: source injection silently yields zero data-tsd-source attributes (AST child-key cache poisoned by regex literals)","articleBody":"### TanStack Devtools version\n\n- `@tanstack/devtools-vite@0.8.5`\n- transitive `@tanstack/devtools-bundler-core@0.1.3`\n- `@tanstack/react-devtools@0.10.12` (transitive `@tanstack/devtools@0.14.2`)\n- Vite `8.2.2`, Astro `7.2.9` (Astro drives Vite here; I could not reproduce with plain Vite)\n- Node `26.7.0`, Linux\n\n### Describe the bug and the steps to reproduce it\n\nThe \"Go to Source\" / source inspector feature injects **zero** `data-tsd-source`\nattributes. There is no browser console warning and nothing in the Vite dev\nserver log, so the feature just silently does nothing.\n\nRoot cause, from reading `@tanstack/devtools-bundler-core/dist/esm/ast-utils.js`.\n`getChildKeys(node)` memoises the child-bearing keys of each AST node type in a\n**module-level** `childKeysCache` Map, seeded from the *first* instance of that\ntype it ever sees:\n\n```js\nfor (const key in node) {\n  if (key === \"type\" || key === \"start\" || key === \"end\") continue;\n  if (typeof node[key] === \"object\") keys.push(key);\n}\n```\n\nA regex literal (`/abc/g`) is an oxc `Literal` whose `value` is an **object**, so\n`value` is cached as a child key for the type `Literal`. Every subsequent\n*string* `Literal` then reaches:\n\n```js\n} else if (\"type\" in value) callback(value);\n```\n\nwith `value` being a string, and throws:\n\n```\nTypeError: Cannot use 'in' operator to search for 'type' in use client\n    at forEachChild (.../@tanstack/devtools-bundler-core/dist/esm/ast-utils.js:31:21)\n```\n\n`\"use client\"` is simply the first string literal in that particular file; the\nthrow happens for any string literal. `addSourceToJsx()` wraps its whole body in\n`try { ... } catch (e) { return; }`, so the TypeError is swallowed and the\nfunction returns `undefined` — no attributes, no log, no warning.\n\nBecause the cache is module-level and shared across every file and every call,\na single regex literal anywhere in the module graph disables source injection\nfor every string literal parsed afterwards. That is why this reproduces in a\nreal dev server but not in an isolated unit test.\n\n### Minimal reproduction\n\nTwo separate `node` processes, same target file (any `.tsx` file with JSX):\n\n```js\nimport { addSourceToJsx } from '@tanstack/devtools-bundler-core'\n\n// Case A — fresh cache: works\naddSourceToJsx(heroCode, heroPath, {})   // -> transformed, N attributes injected\n\n// Case B — parse a regex literal first, then the same file: returns undefined\naddSourceToJsx('const r = /abc/g;\\nexport default r;\\n', regexPath, {})\naddSourceToJsx(heroCode, heroPath, {})   // -> undefined\n```\n\nRun the two cases in **separate processes**. Case A injects the attributes,\nCase B returns `undefined`.\n\nObserved in a real app: a component that reported 36 injected attributes in\nisolation injected 0 once the dev server had processed the rest of the graph.\n\n### Expected behavior\n\nSource injection should not depend on which files were parsed earlier. And a\nfailure inside `addSourceToJsx` should at least be logged rather than swallowed,\nso the feature cannot fail completely silently.\n\n### Suggested fix\n\nGuard the non-array branch the same way the array branch already is:\n\n```diff\n- } else if (\"type\" in value) callback(value);\n+ } else if (typeof value === \"object\" && \"type\" in value) callback(value);\n```\n\nWith that guard, Case B injects the attributes again. A more thorough fix would\nmake `getChildKeys` key the cache on the *shape* of the node (or only record\nkeys whose value is a node or an array of nodes) and drop the bare `catch`.\n\nI am carrying this as a local `patch-package` patch for now.\n\n### Do you intend to try to help solve this bug with your own PR?\n\nMaybe, I'll investigate and start debugging\n\n### Terms & Code of Conduct\n\n- [x] I agree to follow this project's Code of Conduct\n- [x] I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not get fixed and this issue may even be closed.\n","author":{"url":"https://github.com/nencodev","@type":"Person","name":"nencodev"},"datePublished":"2026-09-01T03:14:10Z","url":"https://github.com/TanStack/devtools/issues/523"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:07a9a601-071b-ff68-fec3-80792b24c700
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE81A:153508:41CD03B:55F9150:6AF9ACB3
html-safe-nonce9c7dadce2c6b914787669a9947fa5408270c38eef8a46965cd20b91c2447a453
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODFBOjE1MzUwODo0MUNEMDNCOjU1RjkxNTA6NkFGOUFDQjMiLCJ2aXNpdG9yX2lkIjoiNzg0NDI1NDUzNTIxMDYwOTg0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacccbf7306b6900a7fc67cfc7c74e0039e5ca67e7c5a08246a3c3292e7ac2010cd
hovercard-subject-tagissue:5307384566
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/TanStack/devtools/523/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d6bb4e6f7295cabfb84e9e318a2965f0115aeb13efde4de025b3ae9aec9f1a12/TanStack/devtools/issues/523
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d6bb4e6f7295cabfb84e9e318a2965f0115aeb13efde4de025b3ae9aec9f1a12/TanStack/devtools/issues/523
og:image:altTanStack Devtools version @tanstack/devtools-vite@0.8.5 transitive @tanstack/devtools-bundler-core@0.1.3 @tanstack/react-devtools@0.10.12 (transitive @tanstack/devtools@0.14.2) Vite 8.2.2, Astro 7....
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamenencodev
hostnamegithub.com
expected-hostnamegithub.com
None612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7
turbo-cache-controlno-preview
go-importgithub.com/TanStack/devtools git https://github.com/TanStack/devtools.git
octolytics-dimension-user_id72518640
octolytics-dimension-user_loginTanStack
octolytics-dimension-repository_id1026402761
octolytics-dimension-repository_nwoTanStack/devtools
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1026402761
octolytics-dimension-repository_network_root_nwoTanStack/devtools
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release072e34035c13c31543fba9f025cbbbda4210dae4
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/TanStack/devtools/issues/523#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTanStack%2Fdevtools%2Fissues%2F523
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTanStack%2Fdevtools%2Fissues%2F523
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=TanStack%2Fdevtools
Reloadhttps://github.com/TanStack/devtools/issues/523
Reloadhttps://github.com/TanStack/devtools/issues/523
Reloadhttps://github.com/TanStack/devtools/issues/523
TanStackhttps://github.com/TanStack
devtoolshttps://github.com/TanStack/devtools
Codehttps://github.com/TanStack/devtools
Issues24 (24)https://github.com/TanStack/devtools/issues
Pull requests25 (25)https://github.com/TanStack/devtools/pulls
Discussionshttps://github.com/TanStack/devtools/discussions
Actionshttps://github.com/TanStack/devtools/actions
Security and qualityhttps://github.com/TanStack/devtools/security
Insightshttps://github.com/TanStack/devtools/pulse
https://github.com/TanStack/devtools
New issuehttps://github.com/login?return_to=https://github.com/TanStack/devtools/issues/523
New issuehttps://github.com/login?return_to=https://github.com/TanStack/devtools/issues/523
#539https://github.com/TanStack/devtools/pull/539
devtools-vite: source injection silently yields zero data-tsd-source attributes (AST child-key cache poisoned by regex literals)https://github.com/TanStack/devtools/issues/523#top
#539https://github.com/TanStack/devtools/pull/539
https://github.com/nencodev
nencodevhttps://github.com/nencodev
on Sep 1, 2026https://github.com/TanStack/devtools/issues/523#issue-5307384566
AlemTuzlakhttps://github.com/AlemTuzlak
completedhttps://github.com/TanStack/devtools/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#539https://github.com/TanStack/devtools/pull/539
on Oct 29, 2026https://github.com/TanStack/devtools/issues/523#event-34601840109
thedv91https://github.com/thedv91
on Oct 29, 2026https://github.com/TanStack/devtools/issues/523#event-34612613710
fix(devtools-bundler-core): skip primitive values when walking AST ch…https://github.com/thedv91/devtools/commit/ed8b314173bf2d5550e75c27dbe435e18dc49805
https://docs.github.com/articles/closing-issues-via-commit-messages
ed8b314https://github.com/thedv91/devtools/commit/ed8b314173bf2d5550e75c27dbe435e18dc49805
Sign up for freehttps://github.com/signup?return_to=https://github.com/TanStack/devtools/issues/523
Sign in to commenthttps://github.com/login?return_to=https://github.com/TanStack/devtools/issues/523
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.