Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NX computed hash used for cache is different on every run when no changes are introduced - v2 #20012

Closed
1 of 4 tasks
alvaro450 opened this issue Nov 2, 2023 · 3 comments · Fixed by #20013
Closed
1 of 4 tasks
Assignees
Labels

Comments

@alvaro450
Copy link

Current Behavior

Consistent cache misses for one of our monorepo libraries.

Expected Behavior

When there are no changes on the given library and there is already an entry in cache, it should get the task's output from cache instead of executing the task process again.

GitHub Repo

No response

Steps to Reproduce

Nx Report

Node   : 18.16.0
   OS     : darwin-arm64
   npm    : 9.5.1
   
   nx                 : 17.0.2
   @nx/js             : 17.0.2
   @nx/jest           : 17.0.2
   @nx/linter         : 17.0.2
   @nx/eslint         : 17.0.2
   @nx/workspace      : 17.0.1
   @nx/angular        : 17.0.2
   @nx/cypress        : 17.0.2
   @nx/devkit         : 17.0.2
   @nx/eslint-plugin  : 17.0.2
   @nx/plugin         : 17.0.2
   @nx/storybook      : 17.0.2
   @nrwl/tao          : 17.0.2
   @nx/web            : 17.0.2
   @nx/webpack        : 17.0.2
   typescript         : 4.9.5
   ---------------------------------------
   Community plugins:
   @storybook/angular : 6.5.15
   apollo-angular     : 4.2.1
   ---------------------------------------

Failure Logs

No response

Package Manager Version

npm 9.5.1

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

Same details as the previously opened issue #19275.

The fix that was done on file packages/nx/src/project-graph/utils/retrieve-workspace-files.ts where sorting was added fileData = fileData.concat(globalFiles).sort(); does not properly sort the files given that the argument passed to the sort fn is an object and not a string.

Passing a predicate (a, b) => a.file.localeCompare(b.file) to the sorting function, correctly sorts the files by fileName.

fileData = fileData.concat(globalFiles).sort((a, b) => a.file.localeCompare(b.file));
@AgentEnder AgentEnder added the scope: core core nx functionality label Nov 2, 2023
@Cammisuli
Copy link
Member

Cammisuli commented Nov 2, 2023

oh no, sorry about that! Let me fix that properly 😓 I got too used to sorting in Rust 😅

@alvaro450
Copy link
Author

oh no, sorry about that! Let me fix that properly 😓 I got too used to sorting in Rust 😅

Thank you for the prompt response and resolution!

Copy link

github-actions bot commented Dec 4, 2023

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants