Fix node asset cache busting

This commit is contained in:
cyph3rasi
2026-03-07 20:32:30 -08:00
parent 588307d21e
commit 2acebc15a5
6 changed files with 45 additions and 6 deletions
+13
View File
@@ -0,0 +1,13 @@
export function getNodeAssetVersion(updatedAt: Date | string | null | undefined): string {
if (!updatedAt) {
return Date.now().toString();
}
const timestamp = new Date(updatedAt).getTime();
return Number.isNaN(timestamp) ? Date.now().toString() : timestamp.toString();
}
export function getVersionedNodeAssetUrl(path: string, updatedAt: Date | string | null | undefined): string {
const version = getNodeAssetVersion(updatedAt);
return `${path}?v=${encodeURIComponent(version)}`;
}