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
25 changes: 25 additions & 0 deletions docs/src/layouts/Base.astro
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,30 @@ const { seo, structuredData } = Astro.props;
});
}

// The ClientRouter parses the next page inside a detached document and
// then moves the nodes into the live one. A `<video>` resolves its
// `<source>` during that detached parse, so `currentSrc` is already set
// by the time it lands here — but the resource was selected against the
// dead document and never fetched/decoded in the live one, so the video
// renders blank. The spec only re-runs source selection while
// `networkState === NETWORK_EMPTY`, which is no longer true, so we have to
// force it with an explicit `load()`. We target videos whose `<source>`
// carries a real `src` (the eagerly-sourced blog/MDX videos) and skip the
// homepage feature videos, whose sources only have `data-src` and are
// managed by their own lazy-load observer.
//
// This runs on `astro:after-swap` (client-side navigations only), not
// `astro:page-load`: on a direct load the native parse already populated
// the video correctly, and calling `load()` there would needlessly abort
// the in-flight fetch and flash the poster back in.
const reloadSwappedVideos = () => {
document.querySelectorAll("video").forEach((video) => {
if (video.querySelector("source[src]")) {
video.load();
}
});
Comment thread
Copilot marked this conversation as resolved.
};

document.addEventListener("astro:page-load", () => {
stickyNavInit();
shyNavLogoInit();
Expand All @@ -242,6 +266,7 @@ const { seo, structuredData } = Astro.props;
document.querySelectorAll("[data-aos]").forEach((el) => {
el.classList.remove("aos-animate", "aos-init");
});
reloadSwappedVideos();
});
</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/layouts/partials/FeatureGrid.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const featurePages = rawFeaturePages
featurePages.map((page, index) => {
return (
<a
href={`/features/${page.id}`}
href={`/features/${page.id}/`}
Comment thread
ngnijland marked this conversation as resolved.
class="group block no-underline rounded-2xl border border-border bg-theme-light p-6 transition-all hover:border-primary hover:shadow-lg"
data-aos="fade-up-sm"
data-aos-delay={50 * (index % 3)}
Expand Down
Loading