Skip to content

fix: add cache-buster for provided images - #3082

Merged
AlexAndBear merged 4 commits into
mainfrom
svg-cache-buster
Aug 12, 2026
Merged

fix: add cache-buster for provided images#3082
AlexAndBear merged 4 commits into
mainfrom
svg-cache-buster

Conversation

@AlexAndBear

@AlexAndBear AlexAndBear commented Aug 11, 2026

Copy link
Copy Markdown
Member

Description

image

Related Issue

Update

  • Fixes <issue_link>

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

@AlexAndBear

Copy link
Copy Markdown
Member Author

Why this approach?

This solution uses query parameters (?v=VERSION) for cache busting, which is the most pragmatic choice for our use case:

✅ Advantages:

  • Simple and maintainable: No complex build configuration changes needed
  • Standard practice: Used by major CDNs (Google Fonts, jQuery, Bootstrap)
  • No breaking changes: URLs stay the same, just a parameter added
  • Works immediately: No manifest system or lookup tables required
  • Package-based versioning: Only invalidates cache on actual releases, not every dev build

🤔 Why not hash-based filenames?

We considered using Vite's built-in asset hashing (icon-abc123.svg), but:

  1. vite-plugin-static-copy doesn't support hashing - files are copied as-is
  2. Would require custom tooling: Need to build a manifest mapping icon-name.svgicon-name-abc123.svg
  3. Breaking change: All icon URLs would change, requiring lookup system
  4. Complex for 1000+ icons: Dynamic access pattern (icons/${name}.svg) would need refactoring
  5. Vite's public/ directory also doesn't hash - same problem, different location

📊 Comparison:

Approach Complexity Breaking Change Works Now
Query parameters (this PR) Low No
Hash in filenames High Yes
Import as modules High Yes

The query parameter approach solves the user-reported issue (stale icons after updates) with minimal changes and maximum compatibility.

@AlexAndBear
AlexAndBear requested a review from kulmann August 11, 2026 20:55
@AlexAndBear
AlexAndBear force-pushed the svg-cache-buster branch 2 times, most recently from af05f64 to d2d4978 Compare August 11, 2026 21:13
@fschade

fschade commented Aug 11, 2026

Copy link
Copy Markdown
Member

clever!

@AlexAndBear

Copy link
Copy Markdown
Member Author

clever!

🤷‍♀️

Comment thread packages/design-system/src/helpers/assets.ts Outdated
@AlexAndBear AlexAndBear changed the title fix: add cache-buster for svg images fix: add cache-buster for provided images Aug 12, 2026
@AlexAndBear
AlexAndBear requested a review from JammingBen August 12, 2026 07:33
@AlexAndBear AlexAndBear self-assigned this Aug 12, 2026
@AlexAndBear
AlexAndBear marked this pull request as ready for review August 12, 2026 08:19
@AlexAndBear
AlexAndBear merged commit f9972d4 into main Aug 12, 2026
30 checks passed
@AlexAndBear
AlexAndBear deleted the svg-cache-buster branch August 12, 2026 09:49
openclouders pushed a commit that referenced this pull request Aug 12, 2026
* fix: add cache-buster for svg images

* don't use url constructor

* add to logo

* format
@openclouders openclouders mentioned this pull request Aug 12, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants