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
12 changes: 9 additions & 3 deletions components/ui/tracing-beam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
useTransform,
useScroll,
useSpring,
useMotionValueEvent,
} from "motion/react";
import { cn } from "@/lib/utils";

Expand All @@ -23,6 +24,11 @@ export const TracingBeam = ({

const contentRef = useRef<HTMLDivElement>(null);
const [svgHeight, setSvgHeight] = useState(0);
const [hasScrolled, setHasScrolled] = useState(false);

useMotionValueEvent(scrollYProgress, "change", (latest) => {
setHasScrolled(latest > 0);
});

// Use ResizeObserver to avoid forced reflows
useEffect(() => {
Expand Down Expand Up @@ -69,7 +75,7 @@ export const TracingBeam = ({
}}
animate={{
boxShadow:
scrollYProgress.get() > 0
hasScrolled
? "none"
: "var(--shadow-tracing-beam, rgba(0, 0, 0, 0.24) 0px 3px 8px)",
}}
Expand All @@ -82,11 +88,11 @@ export const TracingBeam = ({
}}
animate={{
backgroundColor:
scrollYProgress.get() > 0
hasScrolled
? "var(--color-tracing-beam-dot-active)"
: "var(--color-tracing-beam-dot-inactive)",
borderColor:
scrollYProgress.get() > 0
hasScrolled
? "var(--color-tracing-beam-border-active)"
: "var(--color-tracing-beam-border-inactive)",
}}
Expand Down
12 changes: 3 additions & 9 deletions public/logos/client/mclabs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions public/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const CACHE_FIRST_PATTERNS = [
const NETWORK_FIRST_PATTERNS = [
/\/api\//,
/\.json$/,
/\.txt$/, // Next.js RSC payloads
];

self.addEventListener('install', (event) => {
Expand Down Expand Up @@ -94,6 +95,25 @@ self.addEventListener('fetch', (event) => {
return;
}

// Network-first for navigation requests (HTML pages)
// Prevents stale HTML from causing hydration mismatches during client-side nav
if (request.mode === 'navigate' || request.destination === 'document') {
event.respondWith(
fetch(request)
.then((response) => {
if (response.status === 200) {
const responseClone = response.clone();
caches.open(CACHE_NAME).then((cache) => {
cache.put(request, responseClone);
});
}
return response;
})
.catch(() => caches.match(request))
);
return;
}

// Stale-while-revalidate for everything else
event.respondWith(
caches.match(request).then((cachedResponse) => {
Expand Down
Loading