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

Filter used in the tree.children doesn't work on windows machine #17011

Closed
1 of 4 tasks
neen-psk opened this issue May 14, 2023 · 1 comment · Fixed by #17016
Closed
1 of 4 tasks

Filter used in the tree.children doesn't work on windows machine #17011

neen-psk opened this issue May 14, 2023 · 1 comment · Fixed by #17016
Assignees
Labels

Comments

@neen-psk
Copy link

neen-psk commented May 14, 2023

Current Behavior

Currently, there is a filter in the tree.children method to exclude deleted files from the list.

res = res.filter((q) => {
const r = this.recordedChanges[join(this.rp(dirPath), q)];
return !r?.isDeleted;
});

However, due to the Windows path separator, this filter fails to work properly on Windows machines. When dirPath is apps/test and q is file-a.json, the join(this.rp(dirPath), q) function returns 'apps\test\file-a.json', which is not recognized by recordedChanges. As a result, the filter always returns true, causing deleted files to remain in the list.

image

Special thanks to @jesusreal for your collab investigation. 🙏

Expected Behavior

The tree.children method should filter out deleted files from the list.

GitHub Repo

https://github.com/neen-psk/nx-tree-children

Steps to Reproduce

  1. Open the workspace above on a Windows machine
  2. Run npm i
  3. Go to the src/app/app.component.spec.ts file where there is a test to add a file with a nested path to the tree then remove it and expect the list from tree.children to be empty
  4. Run the test in that file
  5. You should see the test fails on a Windows machine which indicates that the tree.children doesn't work. As a result, the children list is not empty.

Nx Report

>  NX   Report complete - copy this into the issue template

   Node : 18.15.0
   OS   : win32 x64
   npm  : 9.5.0

   nx                      : 15.9.2
   @nrwl/js                : 15.9.2
   @nrwl/jest              : 15.9.2
   @nrwl/linter            : 15.9.2
   @nrwl/workspace         : 15.9.2
   @nrwl/angular           : 15.9.2
   @nrwl/cli               : 15.9.2
   @nrwl/cypress           : 15.9.2
   @nrwl/devkit            : 16.1.4
   @nrwl/eslint-plugin-nx  : 15.9.2
   @nrwl/tao               : 15.9.2
   @nrwl/web               : 15.9.2
   @nrwl/webpack           : 15.9.2
   typescript              : 4.9.5
   ---------------------------------------
   The following packages should match the installed version of nx
     - @nrwl/[email protected]

   To fix this, run `nx migrate [email protected]

Failure Logs

No response

Operating System

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

Additional Information

No response

@github-actions
Copy link

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 Jun 15, 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.

2 participants