Repository navigation
feat(Viewer): fingerprint CSS asset - #1192
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe Viewer component now loads its CSS through a computed URL that uses .NET 9+ asset fingerprinting for cache-busting, with a backward-compatible fallback for earlier target frameworks. Flow diagram for fingerprinted Viewer CSS loadingflowchart TD
A[Viewer component renders] --> B[Compute StyleUrl]
B --> C{Target framework}
C -->|NET9_0_OR_GREATER| D["Assets[StylePath]"]
C -->|Earlier frameworks| E[StylePath]
D --> F[Load fingerprinted CSS]
E --> G[Load static CSS path]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/components/BootstrapBlazor.Viewer/Viewer.razor.cs" line_range="23" />
<code_context>
+ private const string StylePath = "_content/BootstrapBlazor.Viewer/lib/viewerjs/viewer.min.css";
+
+#if NET9_0_OR_GREATER
+ private string StyleUrl => Assets[StylePath];
+#else
+ private static string StyleUrl => StylePath;
</code_context>
<issue_to_address>
**Viewer CSS fails during rollout**
When a deployment changes the Viewer CSS while old and new replicas are both serving requests, `StyleUrl` emits the fingerprinted CSS URL, but an old replica does not have the new fingerprint in its static assets. If the stylesheet request reaches that replica during a rolling deployment, it returns 404 and the Viewer appears unstyled.
Serve fingerprinted assets from a shared versioned store or retain old fingerprinted assets on replicas throughout the rollout.
</issue_to_address>| private const string StylePath = "_content/BootstrapBlazor.Viewer/lib/viewerjs/viewer.min.css"; | ||
|
|
||
| #if NET9_0_OR_GREATER | ||
| private string StyleUrl => Assets[StylePath]; |
There was a problem hiding this comment.
🟡 Medium · Viewer CSS fails during rollout
When a deployment changes the Viewer CSS while old and new replicas are both serving requests, StyleUrl emits the fingerprinted CSS URL, but an old replica does not have the new fingerprint in its static assets. If the stylesheet request reaches that replica during a rolling deployment, it returns 404 and the Viewer appears unstyled.
Serve fingerprinted assets from a shared versioned store or retain old fingerprinted assets on replicas throughout the rollout.
Prompt for AI agents
In `src/components/BootstrapBlazor.Viewer/Viewer.razor.cs` at line 23:
**Viewer CSS fails during rollout**
When a deployment changes the Viewer CSS while old and new replicas are both serving requests, `StyleUrl` emits the fingerprinted CSS URL, but an old replica does not have the new fingerprint in its static assets. If the stylesheet request reaches that replica during a rolling deployment, it returns 404 and the Viewer appears unstyled.
Serve fingerprinted assets from a shared versioned store or retain old fingerprinted assets on replicas throughout the rollout.
Link issues
fixes #1191
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Enable cache-busted loading of the Viewer CSS asset while retaining compatibility with older target frameworks.
Bug Fixes:
Enhancements:
Build: