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

file-entry-cache - fixing bug on save meta.data and changed state #904

Conversation

jaredwray
Copy link
Owner

@jaredwray jaredwray commented Nov 23, 2024

Please check if the PR fulfills these requirements

  • Followed the Contributing guidelines.
  • Tests for the changes have been added (for bug fixes/features) with 100% code coverage.
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
file-entry-cache - fixing bug on save meta.data and changed state #901

@jaredwray jaredwray merged commit 9ee9ccf into main Nov 23, 2024
5 checks passed
@jaredwray jaredwray deleted the file-entry-cache---fixing-bug-on-save-meta.data-and-changed-state branch November 23, 2024 21:13
Copy link

codecov bot commented Nov 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (c153b7c) to head (50a90b5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #904   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines           67        67           
=========================================
  Hits            67        67           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

const fileDescriptor4 = fileEntryCache3.getFileDescriptor(testFile1);
expect(fileDescriptor4).toBeDefined();
expect(fileDescriptor4.meta.data).toEqual(data2);
expect(fileDescriptor4.changed).toEqual(true);
Copy link

Choose a reason for hiding this comment

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

Why do you expect changed to be true?

The file didn't change. Yes, meta.data had gotten added.

In my case, I only care if the file changed, not the meta.data. I'm ok with being responsible for detecting changes to the meta.data if necessary.

@@ -288,20 +290,26 @@ export class FileEntryCache {
return result;
}

if (result.meta.data !== metaCache.data) {
Copy link

Choose a reason for hiding this comment

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

result.meta.data is always undefined. It is caused by line 262.

fstat = fs.statSync(filePath);
// Get the file size
result.meta = {
	size: fstat.size,
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants