Skip to content

fix(loadConfig): Fix date comparison in loadConfig #344

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

Closed

Conversation

rpereira-anchor
Copy link

@rpereira-anchor rpereira-anchor commented Jun 12, 2024

Pull Request Name

Fix date comparison in loadConfig

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes #343

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested locally to see if it indeed uses the cached config
Place a console.log inside each if statement

      if (stats === null) {
        loadedConfig = {};
         console.log("1")
      } else if (lastModifiedDate !== stats.mtime.getTime()) {
        lastModifiedDate = stats.mtime.getTime();
        loadedConfig = requireUncached(resolvedPath);
         console.log("2")
      } else {
        loadedConfig = null;
         console.log("3")
      }

2 appears once followed by multiple instances of 3

Test Configuration:

  • Debian 11
  • yarn 4
  • Node 18

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@francoismassart
Copy link
Owner

Hi @rpereira-anchor,
please try out this beta version which should fix your issue:

npm i [email protected] -D

Thank you for your feedback

@francoismassart
Copy link
Owner

Should be fixed in latest release (3.17.4)

@rpereira-anchor
Copy link
Author

comfirmed as fixed

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

Successfully merging this pull request may close these issues.

[BUG] loadConfig never uses cache
2 participants