Skip to content

fix(core): invalidate project graph when external nodes change#32626

Merged
FrozenPandaz merged 3 commits intomasterfrom
fix/nxc-3043
Sep 8, 2025
Merged

fix(core): invalidate project graph when external nodes change#32626
FrozenPandaz merged 3 commits intomasterfrom
fix/nxc-3043

Conversation

@leosvelperez
Copy link
Copy Markdown
Member

Current Behavior

When external nodes change, the project graph cache is not invalidated. This can sometimes lead to missing dependencies due to reusing cached dependencies for nodes that no longer exist.

Expected Behavior

When external nodes change, the project graph cache should be invalidated.

@leosvelperez leosvelperez self-assigned this Sep 5, 2025
@leosvelperez leosvelperez requested a review from a team as a code owner September 5, 2025 12:23
@vercel
Copy link
Copy Markdown

vercel Bot commented Sep 5, 2025

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

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Sep 8, 2025 8:59am

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Sep 5, 2025

View your CI Pipeline Execution ↗ for commit 7a21f09

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 3m 38s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 2m 24s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 6s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 5s View ↗
nx documentation ✅ Succeeded 1m 56s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-08 11:56:00 UTC

Comment thread packages/nx/src/project-graph/nx-deps-cache.ts Outdated
Comment thread packages/nx/src/project-graph/nx-deps-cache.ts Outdated
Comment thread packages/nx/src/project-graph/nx-deps-cache.ts Outdated
Comment thread packages/nx/src/project-graph/nx-deps-cache.ts Outdated
});
}

function getExternalNodesData(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have to reduce this or can we hash the whole thing?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think we should. Benchmarking both approaches in this repo:

Hash full external nodes: 27.798042000000002ms
Reduce and hash external nodes: 4.348999999999997ms

That's a ~6x time reduction, which is significant.

@FrozenPandaz FrozenPandaz merged commit 5011ecd into master Sep 8, 2025
17 of 18 checks passed
@FrozenPandaz FrozenPandaz deleted the fix/nxc-3043 branch September 8, 2025 19:33
FrozenPandaz pushed a commit that referenced this pull request Sep 10, 2025
## Current Behavior

When external nodes change, the project graph cache is not invalidated.
This can sometimes lead to missing dependencies due to reusing cached
dependencies for nodes that no longer exist.

## Expected Behavior

When external nodes change, the project graph cache should be
invalidated.

(cherry picked from commit 5011ecd)
@github-actions
Copy link
Copy Markdown
Contributor

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 Sep 14, 2025
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