Skip to content

Cache blog metadata and posts, simplify motion components, improve scroll handling and font usage#3

Draft
jakemcquade wants to merge 1 commit intomainfrom
codex/perform-performance-optimizations-532ou4
Draft

Cache blog metadata and posts, simplify motion components, improve scroll handling and font usage#3
jakemcquade wants to merge 1 commit intomainfrom
codex/perform-performance-optimizations-532ou4

Conversation

@jakemcquade
Copy link
Owner

Motivation

  • Reduce redundant work at runtime and make blog processing Workers-safe by caching post metadata and compiled post content.
  • Improve runtime performance and memory by reusing the Shiki highlighter and returning metadata synchronously where possible.
  • Fix scroll button behavior to be more robust and performant and simplify motion animation usage to match the motion/react API.
  • Consolidate font handling into CSS variable usage and tidy build config for predictable sourcemap behavior.

Description

  • Introduced metadataCache and postCache in src/lib/blog.ts and added a singleton highlighterPromise so getPost caches compiled posts and reuses the Shiki engine, while getBlogPosts now returns synchronous metadata entries via getPostMetadata.
  • Updated page components to align with the new API by removing unnecessary await calls (src/app/blog/page.tsx and src/app/blog/[slug]/page.tsx) and making Blog an async component where appropriate.
  • Reworked BackUp (src/components/backup.tsx) to use addEventListener/removeEventListener for scroll with a passive listener and a safe early return if the button node is missing, including cleanup on unmount.
  • Simplified motion components: removed AnimatePresence and adapted BlurFadeText and BlurFade to use motion directly, added useMemo for defaultVariants in BlurFade to avoid recreating variant objects, and removed unused imports.
  • Adjusted global layout/font handling by using the Inter font variable class in the body and switching the root font-family in src/styles/globals.css to reference var(--font-sans) with fallbacks.
  • Updated vite.config.ts to disable sourcemaps in build and ensure rsc() is included in the plugin list (formatting tidy-up).

Testing

  • Ran TypeScript type-check with tsc --noEmit and it completed successfully.
  • Performed a production build with vite build to validate the Vite configuration and bundling, which succeeded.

Codex Task

@vercel
Copy link

vercel bot commented Mar 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
jakemc.dev Error Error Mar 4, 2026 7:04pm

@deepsource-io
Copy link
Contributor

deepsource-io bot commented Mar 4, 2026

DeepSource Code Review

We reviewed changes in 1ccec82...eb9d767 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade  

Focus Area: Reliability
Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript Mar 4, 2026 7:02p.m. Review ↗

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant