Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ Presentation-layer note:
### Article preview

- when enabled in Reader settings, clicking any card (including its title) loads a reader view in a right-hand panel instead of opening a new tab
- while the preview request is in flight, the panel keeps the card title until the delayed skeleton appears; the skeleton then replaces the provisional title and mimics the article title/byline/body rhythm, and the fetched title and content fade in. A failed request clears the skeleton, restores the card title, and shows a readable error message
- opening the preview immediately shows the reader skeleton, starting with a title placeholder; the provisional card title is not shown, and the fetched title/content fade in. A failed request clears the skeleton, restores the card title, and shows a readable error message
- transient upstream `429`/`5xx` responses are retried once with jitter; blocked sources, timeouts, unsupported formats, and failed fetches get specific messages
- the visible loading message is visually hidden while the skeleton is shown; the panel remains `aria-busy` and a live region announces the loading state
- `Cmd`/`Ctrl`/`Shift`-clicking a title still opens the article in a new tab
Expand Down
2 changes: 1 addition & 1 deletion core/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export function renderIndexPage(data: PageData): string {
<link rel="apple-touch-icon" href="/apple-touch-icon.png?v=8" />
<script>${data.themeInitScript}</script>
<style>${data.inlineCss}</style>
<script src="/static/app.js?v=111" defer></script>
<script src="/static/app.js?v=112" defer></script>
</head>
<body data-app-version="${escapeHtml(data.appVersion)}">
<div class="boot-veil" data-boot-veil aria-hidden="true">
Expand Down
2 changes: 1 addition & 1 deletion core/test/render.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("renderIndexPage", () => {
expect(html).toContain(
"<script>document.documentElement.dataset.theme='dark';</script>",
);
expect(html).toContain('/static/app.js?v=111');
expect(html).toContain('/static/app.js?v=112');
expect(html).not.toContain("style.css");
expect(html).not.toContain("theme-init.js");
});
Expand Down
2 changes: 1 addition & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Browser-only preferences and reading state live in `localStorage`: theme prefere

- The inline pre-paint theme script also records `display-mode: standalone` (and iOS `navigator.standalone`) as `data-standalone`. The server renders a lightweight boot veil; CSS only displays it in an installed app, and `app.js` fades and removes it after the first content frame. Browser tabs never see it, so it does not affect LCP.
- Client-side feed loads use skeleton cards. A 150 ms delay avoids flashing placeholders on fast responses when a feed is already on screen (an empty grid shows them immediately); replace loads snapshot the current grid so a failed request can restore it, and append loads add three skeleton rows at the bottom.
- The reader preview uses the same delayed-skeleton idea: the provisional card title stays visible for the first 150 ms, then the skeleton hides it and starts with a title placeholder followed by byline/body rhythm; the fetched title and content fade in. Aborts and failures clear the skeleton, restore the card title, and show the readable status message. A transient `503` from the preview endpoint is retried once after 500 ms; `429`s are not retried because the limiter's `Retry-After` is 60 seconds.
- The reader preview shows its skeleton immediately, starting with a title placeholder; the provisional card title is never shown, and the fetched title/content fade in. Aborts and failures clear the skeleton, restore the card title, and show the readable status message. Feed skeletons keep their 150 ms delay to avoid flashing on fast feed loads. A transient `503` from the preview endpoint is retried once after 500 ms; `429`s are not retried because the limiter's `Retry-After` is 60 seconds.
- Skeleton cards are `aria-hidden`; the grid sets `aria-busy`, and a visually hidden live region carries the loading message.
- Completed replace loads crossfade through the View Transitions API when available, with a Web Animations fade fallback. `prefers-reduced-motion: reduce` disables shimmer and both transition paths.
- The search field hides the browser's native `type="search"` clear control; the app's search toggle/close button is the only clear affordance.
Expand Down
2 changes: 1 addition & 1 deletion docs/RUNBOOK.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Before considering any `core/render.ts` change done:
- the response carries `Cache-Control: private, no-store` (the five-minute edge copy lives in the Cache API and is rewritten to this header on the way out)
- in a regular browser tab the launch veil stays hidden (`display: none`) and is removed from the DOM; in an installed/standalone window it is visible and fades out within about a second
- throttle the network, then change a source filter or run a search: skeleton cards appear after ~150 ms and are replaced by the new cards; `View more` appends three skeleton rows
- enable article preview, throttle the network, and open a card: after ~150 ms the provisional card title is replaced by the preview skeleton (title, byline, and body placeholders), then the fetched title/content fade in; a failed preview clears the skeleton, restores the card title, and shows the error status
- enable article preview, throttle the network, and open a card: the reader skeleton appears immediately (title, byline, and body placeholders) and the provisional card title is not shown; the fetched title/content then fade in. A failed preview clears the skeleton, restores the card title, and shows the error status
- with `prefers-reduced-motion: reduce`, skeleton shimmer and the view/Web Animations transitions are disabled
- typing in the search box shows only the app's close control, not a second native clear X
- header actions render correctly
Expand Down
4 changes: 2 additions & 2 deletions web-static/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const SHELL_CACHE = "reader-shell-v145";
const SHELL_CACHE = "reader-shell-v146";
const ITEMS_CACHE = "reader-items-v24";
const CORE_ASSETS = [
"/",
"/static/app.js?v=111",
"/static/app.js?v=112",
"/static/source-icons/hackernews.svg",
"/static/source-icons/github.svg",
"/static/source-icons/huggingface.svg",
Expand Down
19 changes: 1 addition & 18 deletions web-static/static/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@
let reconnectRefetchInFlight = false;
let deferredInstallPrompt = null;
let previewRequestSequence = 0;
let previewSkeletonTimer = null;
let previewAbortController = null;
let currentPreviewItem = null;
let currentCardActionData = null;
Expand Down Expand Up @@ -1410,15 +1409,7 @@
);
};

const clearPreviewSkeletonTimer = () => {
if (previewSkeletonTimer !== null) {
window.clearTimeout(previewSkeletonTimer);
previewSkeletonTimer = null;
}
};

const showPreviewSkeleton = (requestId) => {
previewSkeletonTimer = null;
if (requestId !== previewRequestSequence || !previewContent) return;
setPreviewTitleLoading(true);
previewContent.innerHTML = previewSkeletonMarkup;
Expand Down Expand Up @@ -2183,7 +2174,6 @@
}

const resetPreviewPanel = () => {
clearPreviewSkeletonTimer();
resetPreviewSwipeState();
closePreviewActionsDialog();
previewPanel?.classList.add("is-hidden");
Expand Down Expand Up @@ -2303,7 +2293,6 @@
previewAbortController?.abort();
const controller = new AbortController();
previewAbortController = controller;
clearPreviewSkeletonTimer();

lockPreviewScroll();
previewPanel.classList.remove("is-hidden");
Expand All @@ -2316,7 +2305,6 @@
syncPreviewChromeHeights();
setPreviewCommentsLink(commentsUrl);
setPreviewTitle(title);
setPreviewTitleLoading(false);
if (previewByline) {
previewByline.textContent = "";
previewByline.classList.add("is-hidden");
Expand All @@ -2332,10 +2320,7 @@
setPreviewStatus("Loading preview…", { visuallyHidden: true });
previewScroll?.scrollTo({ top: 0 });
resetPreviewChrome();
previewSkeletonTimer = window.setTimeout(
() => showPreviewSkeleton(requestId),
150,
);
showPreviewSkeleton(requestId);

fetchPreviewWithRetry(url, controller.signal)
.then(async (response) => {
Expand All @@ -2356,7 +2341,6 @@
})
.then((payload) => {
if (!payload || requestId !== previewRequestSequence) return;
clearPreviewSkeletonTimer();
const blocks = Array.isArray(payload.blocks) ? payload.blocks : [];
const nextTitle =
typeof payload.title === "string" && payload.title.trim() !== ""
Expand Down Expand Up @@ -2407,7 +2391,6 @@
) {
return;
}
clearPreviewSkeletonTimer();
previewContent?.replaceChildren();
previewByline?.classList.add("is-hidden");
previewReadingMeta?.classList.add("is-hidden");
Expand Down
6 changes: 3 additions & 3 deletions web-static/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2115,9 +2115,9 @@ body.is-dialog-open {
height: 0.52rem;
}

/* Reader-panel skeleton: the provisional card title is hidden when this
appears, so the placeholder starts with a title line and mirrors the
article block rhythm. */
/* Reader-panel skeleton: shown immediately, with the provisional card title
hidden so a stale title never appears before the fetched one. The first
placeholder stands in for the article title. */
.preview-panel-title.is-preview-loading {
display: none;
}
Expand Down
Loading