Skip to content

feat(Viewer): fingerprint CSS asset - #1192

Merged
ArgoZhang merged 2 commits into
masterfrom
dev-Viewer
Oct 19, 2026
Merged

ArgoZhang merged 2 commits into
masterfrom
dev-Viewer

Conversation

@ArgoZhang

@ArgoZhang ArgoZhang commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Link issues

fixes #1191

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Enable cache-busted loading of the Viewer CSS asset while retaining compatibility with older target frameworks.

Bug Fixes:

  • Fingerprint the Viewer CSS asset on .NET 9 and later to ensure browsers receive updated styles when the asset changes.

Enhancements:

  • Preserve the existing unversioned Viewer CSS path for targets before .NET 9.

Build:

  • Update the Viewer project configuration to support the fingerprinted CSS asset.

ArgoZhang and others added 2 commits October 18, 2026 14:30
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sourcery-ai

sourcery-ai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The 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 loading

flowchart 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]
Loading

File-Level Changes

Change Details Files
Adds framework-aware fingerprinting for the Viewer CSS asset while preserving the existing unversioned path on older targets.
  • Introduces a shared CSS asset path constant.
  • Resolves the CSS URL through the generated asset manifest on .NET 9 and later.
  • Uses the original static asset path for pre-.NET 9 targets.
  • Updates the Razor markup to reference the computed stylesheet URL.
  • Updates project configuration to support the asset fingerprinting setup.
src/components/BootstrapBlazor.Viewer/BootstrapBlazor.Viewer.csproj
src/components/BootstrapBlazor.Viewer/Viewer.razor
src/components/BootstrapBlazor.Viewer/Viewer.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#1191 Fingerprint the Viewer component's CSS asset so its URL can reflect the asset's content and support cache-busting. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto Bot added the enhancement New feature or request label Oct 19, 2026
@bb-auto bb-auto Bot added this to the v10.0.0 milestone Oct 19, 2026

@bb-auto bb-auto Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto approved by bb-auto

@ArgoZhang
ArgoZhang merged commit 591477a into master Oct 19, 2026
3 checks passed
@ArgoZhang
ArgoZhang deleted the dev-Viewer branch October 19, 2026 01:59

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

private const string StylePath = "_content/BootstrapBlazor.Viewer/lib/viewerjs/viewer.min.css";

#if NET9_0_OR_GREATER
private string StyleUrl => Assets[StylePath];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(Viewer): fingerprint CSS asset

1 participant