From 17e4782140a602043c4f92e643c1908c521ae017 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 12 Apr 2023 18:04:45 -0400 Subject: fix(npm): eagerly reload package information when version from lockfile not found locally (#18673) Closes #18624 --- cli/npm/installer.rs | 1 - cli/npm/registry.rs | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'cli/npm') diff --git a/cli/npm/installer.rs b/cli/npm/installer.rs index 5a15494ab..9e5fcc4c3 100644 --- a/cli/npm/installer.rs +++ b/cli/npm/installer.rs @@ -104,7 +104,6 @@ impl PackageJsonDepsInstaller { if inner.npm_registry_api.mark_force_reload() { log::debug!("Failed to resolve package. Retrying. Error: {err:#}"); // re-initialize - inner.npm_registry_api.clear_memory_cache(); reqs_with_info_futures = inner.reqs_with_info_futures(); } else { return Err(err.into()); diff --git a/cli/npm/registry.rs b/cli/npm/registry.rs index b38cfa898..798cb17dd 100644 --- a/cli/npm/registry.rs +++ b/cli/npm/registry.rs @@ -112,7 +112,12 @@ impl CliNpmRegistryApi { ) { return false; } - self.inner().force_reload_flag.raise() + if self.inner().force_reload_flag.raise() { + self.clear_memory_cache(); // clear the memory cache to force reloading + true + } else { + false + } } fn inner(&self) -> &Arc { -- cgit v1.2.3