Skip to content

fix(js): use per-invocation cache in TS plugin to fix NX_ISOLATE_PLUGINS=false#34566

Merged
Coly010 merged 1 commit intomasterfrom
fix-ts-plugin-caching
Feb 24, 2026
Merged

fix(js): use per-invocation cache in TS plugin to fix NX_ISOLATE_PLUGINS=false#34566
Coly010 merged 1 commit intomasterfrom
fix-ts-plugin-caching

Conversation

@Coly010
Copy link
Copy Markdown
Contributor

@Coly010 Coly010 commented Feb 24, 2026

When plugin isolation is off, concurrent createNodesV2 invocations share
the same module instance. The module-level mutable cache variable caused
invocation A's finally block to null it out while invocation B was still
reading from it, resulting in "Cannot read properties of null (reading
'configContexts')".

Replace the shared mutable cache with a Symbol-keyed Map so each
invocation gets its own isolated cache. The tsconfig disk cache is shared
across invocations with an idempotent initialization guard.

CLOSES NXC-3971

…INS=false

When plugin isolation is off, concurrent createNodesV2 invocations share
the same module instance. The module-level mutable `cache` variable caused
invocation A's `finally` block to null it out while invocation B was still
reading from it, resulting in "Cannot read properties of null (reading
'configContexts')".

Replace the shared mutable `cache` with a Symbol-keyed Map so each
invocation gets its own isolated cache. The tsconfig disk cache is shared
across invocations with an idempotent initialization guard.
@Coly010 Coly010 requested a review from a team as a code owner February 24, 2026 10:24
@Coly010 Coly010 requested a review from JamesHenry February 24, 2026 10:24
@Coly010 Coly010 self-assigned this Feb 24, 2026
@netlify
Copy link
Copy Markdown

netlify bot commented Feb 24, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 4341d21
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/699d7c7ac0e763000828b04a
😎 Deploy Preview https://deploy-preview-34566--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 24, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 4341d21
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/699d7c7a958341000837854a
😎 Deploy Preview https://deploy-preview-34566--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud bot commented Feb 24, 2026

View your CI Pipeline Execution ↗ for commit 4341d21

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 1h 1m 29s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3m 10s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 8s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-24 11:30:48 UTC

@Coly010 Coly010 merged commit 1a15ea1 into master Feb 24, 2026
25 checks passed
@Coly010 Coly010 deleted the fix-ts-plugin-caching branch February 24, 2026 12:51
FrozenPandaz pushed a commit that referenced this pull request Feb 26, 2026
…INS=false (#34566)

When plugin isolation is off, concurrent createNodesV2 invocations share
the same module instance. The module-level mutable `cache` variable
caused
invocation A's `finally` block to null it out while invocation B was
still
reading from it, resulting in "Cannot read properties of null (reading
'configContexts')".

Replace the shared mutable `cache` with a Symbol-keyed Map so each
invocation gets its own isolated cache. The tsconfig disk cache is
shared
across invocations with an idempotent initialization guard.

CLOSES NXC-3971

(cherry picked from commit 1a15ea1)
FrozenPandaz pushed a commit that referenced this pull request Feb 26, 2026
…INS=false (#34566)

When plugin isolation is off, concurrent createNodesV2 invocations share
the same module instance. The module-level mutable `cache` variable
caused
invocation A's `finally` block to null it out while invocation B was
still
reading from it, resulting in "Cannot read properties of null (reading
'configContexts')".

Replace the shared mutable `cache` with a Symbol-keyed Map so each
invocation gets its own isolated cache. The tsconfig disk cache is
shared
across invocations with an idempotent initialization guard.

CLOSES NXC-3971

(cherry picked from commit 1a15ea1)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 2, 2026

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants