Skip to content

docs: banner cache + fallback color tweaks#111

Merged
jdx merged 2 commits intomainfrom
feat/banner-followups-2
Apr 23, 2026
Merged

docs: banner cache + fallback color tweaks#111
jdx merged 2 commits intomainfrom
feat/banner-followups-2

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Apr 23, 2026

Follow-ups after #110 merged.

Summary

  • Drop `cache: "no-cache"` from the banner fetch. The server already sends `Cache-Control: public, max-age=300, must-revalidate`, so default browser caching gives 5-min freshness without a conditional GET on every page load.
  • Fix the banner background fallback color. Previously fell back to `#3451b2` (VitePress dark blue), which rendered black banner text unreadable if `--vp-c-brand-1` ever fails to resolve. Now falls back to `#ff71ce` (the actual communique brand).

\U0001F916 Generated with Claude Code


Note

Low Risk
Low risk: only adjusts docs-site banner styling and removes a no-cache fetch option, which may slightly change how quickly banner updates propagate but doesn’t affect core app logic.

Overview
Updates the docs announcement banner to rely on default browser caching by removing cache: "no-cache" from the fetch in initBanner().

Also changes the banner background fallback color in banner.css to #ff71ce to keep text readable if --vp-c-brand-1 isn’t defined.

Reviewed by Cursor Bugbot for commit 67ff10a. Bugbot is set up for automated code reviews on this repo. Configure here.

jdx and others added 2 commits April 23, 2026 14:37
no-cache forces a conditional GET on every page load. The server sends
Cache-Control: public, max-age=300, must-revalidate, so default browser
caching already gives 5-min freshness, which is plenty for an
announcement banner. Returning users with a dismissed banner also
already short-circuit via localStorage before the fetch runs anyway.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The previous fallback (#3451b2, VitePress default dark blue) made black
banner text unreadable if --vp-c-brand-1 ever fails to resolve. Use a
fallback that matches this site's actual brand color so black text
stays readable in the fallback scenario.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@jdx jdx enabled auto-merge (squash) April 23, 2026 19:38
@jdx jdx merged commit 5eaf571 into main Apr 23, 2026
7 checks passed
@jdx jdx deleted the feat/banner-followups-2 branch April 23, 2026 19:38
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.08%. Comparing base (bfef7f6) to head (67ff10a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #111   +/-   ##
=======================================
  Coverage   94.08%   94.08%           
=======================================
  Files          26       26           
  Lines        4055     4055           
  Branches     4055     4055           
=======================================
  Hits         3815     3815           
  Misses        155      155           
  Partials       85       85           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 23, 2026

Greptile Summary

Two targeted follow-up tweaks to the banner introduced in #110: the fetch no longer overrides browser caching (letting the server's Cache-Control: public, max-age=300, must-revalidate do its job), and the CSS fallback color is corrected to the communique brand pink (#ff71ce) so black banner text stays readable if --vp-c-brand-1 fails to resolve.

Confidence Score: 5/5

Safe to merge — both changes are small, correct, and well-reasoned with no logic or security concerns.

No P0 or P1 findings. The cache removal correctly defers to the server-provided Cache-Control header, and the fallback color fix improves readability. All remaining quality is P2 or better.

No files require special attention.

Important Files Changed

Filename Overview
docs/.vitepress/theme/banner.css Fallback background color changed from #3451b2 (VitePress dark blue, unreadable with black text) to #ff71ce (brand pink, legible with black text). Clean fix.
docs/.vitepress/theme/banner.ts Removed cache: "no-cache" from fetch, deferring to server-sent Cache-Control (max-age=300, must-revalidate) for 5-min browser caching instead of a conditional GET on every page load.

Sequence Diagram

sequenceDiagram
    participant Browser
    participant Cache as Browser Cache
    participant Server as jdx.dev/banner.json
    participant LS as localStorage

    Browser->>Cache: fetch(ENDPOINT) [default mode]
    alt Cache hit (within max-age=300s)
        Cache-->>Browser: Cached BannerData (no network request)
    else Cache miss or expired
        Cache->>Server: GET /banner.json
        Server-->>Cache: 200 + Cache-Control: public, max-age=300, must-revalidate
        Cache-->>Browser: BannerData
    end
    Browser->>LS: getItem("jdx-banner-dismissed")
    alt Banner not dismissed & enabled
        Browser->>Browser: render(b) — inject .jdx-banner div
        Note over Browser: background: var(--vp-c-brand-1, #ff71ce)
    end
Loading

Reviews (1): Last reviewed commit: "docs: fix banner fallback color to match..." | Re-trigger Greptile

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the banner's fallback background color to improve readability and removes the no-cache fetch configuration. Feedback suggests addressing potential contrast issues when the primary CSS variable is used and preventing duplicate banner rendering in SPA environments through a DOM check.

justify-content: center;
padding: 0.5rem 2.75rem;
background: var(--vp-c-brand-1, #3451b2);
background: var(--vp-c-brand-1, #ff71ce);
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

While changing the fallback color to #ff71ce improves readability when the CSS variable is missing, the primary background still uses --vp-c-brand-1. In many VitePress themes, this variable defaults to a dark color (like the #3451b2 mentioned in the PR description), which will still result in unreadable black text. To fully resolve the readability issue, consider using a background color that is guaranteed to contrast with black text, or use a corresponding variable for the text color.

export function initBanner(): void {
if (typeof window === "undefined") return;
fetch(ENDPOINT, { cache: "no-cache" })
fetch(ENDPOINT)
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

In a Single Page Application (SPA) context like VitePress, initBanner might be called multiple times during navigation. Since the render function prepends a new element to the DOM without checking for existing ones, this could result in multiple banners being displayed. It's safer to check for an existing banner before initiating the fetch.

Suggested change
fetch(ENDPOINT)
if (document.querySelector(".jdx-banner")) return;
fetch(ENDPOINT)

jdx added a commit that referenced this pull request Apr 23, 2026
A small patch release that fixes a panic when generating notes against
releases with multi-byte characters in their bodies, and picks up a
security fix in `rustls-webpki`.

## Fixed

- **Don't panic on multi-byte chars in style-reference bodies** —
`communique generate` truncates each recent release body to 3072 bytes
to keep the prompt small, but previously sliced `&body[..3072]`
directly. If byte 3072 fell inside a multi-byte UTF-8 character (common
with em-dashes, which are 3 bytes), the command would panic with `byte
index 3072 is not a char boundary`. The truncation now walks back to the
nearest char boundary before slicing, with a regression test covering
the case. ([#113](#113)) (@jdx)

## Security

- **`rustls-webpki` bumped to 0.103.13** — Addresses
[RUSTSEC-2026-0104](https://rustsec.org/advisories/RUSTSEC-2026-0104), a
reachable panic in certificate revocation list parsing. Lockfile-only
change. ([#107](#107)) (@jdx)

## Docs

- Added a dismissible cross-site announcement banner and an en.dev
footer to the documentation site, with follow-up polish (contrast,
centering, z-index), smarter caching, and `ResizeObserver`-based height
syncing so VitePress's nav offset stays correct on resize.
([#109](#109),
[#110](#110),
[#111](#111),
[#112](#112)) (@jdx)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant