@way_marks/server 4.4.5 → 4.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/services/version.js +15 -5
- package/package.json +1 -1
package/dist/services/version.js
CHANGED
|
@@ -162,11 +162,21 @@ async function getVersionInfo() {
|
|
|
162
162
|
// Check cache first
|
|
163
163
|
const cache = readCacheFile();
|
|
164
164
|
if (cache && isCacheValid(cache)) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
165
|
+
// Smart cache invalidation: if current version is newer than cached latest,
|
|
166
|
+
// the cache is stale (e.g., new version was released and installed)
|
|
167
|
+
const currentIsNewer = compareVersions(cache.latestVersion, currentVersion);
|
|
168
|
+
if (currentIsNewer) {
|
|
169
|
+
// Cache is stale, invalidate it and fetch fresh data
|
|
170
|
+
// This prevents showing "update available" when user already has the latest
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
// Cache is good
|
|
174
|
+
return {
|
|
175
|
+
currentVersion,
|
|
176
|
+
latestVersion: cache.latestVersion,
|
|
177
|
+
updateAvailable: compareVersions(currentVersion, cache.latestVersion),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
170
180
|
}
|
|
171
181
|
// Prevent multiple concurrent fetches within a short window
|
|
172
182
|
const now = Date.now();
|