Skip to content

App first-load performance#15

Draft
bstanfield wants to merge 1 commit into
masterfrom
cursor/app-first-load-performance-0114
Draft

App first-load performance#15
bstanfield wants to merge 1 commit into
masterfrom
cursor/app-first-load-performance-0114

Conversation

@bstanfield

Copy link
Copy Markdown
Owner

Significantly improve first-load performance by upgrading Next.js/React and implementing modern web optimizations.

This PR upgrades core dependencies (Next.js 9.3.5 -> 14.2.21, React 16.13.1 -> 18.3.1) to leverage automatic code-splitting and SWC compilation. Further optimizations include lazy-loading heavy components (SearchBar), applying React.memo for efficient re-renders, optimizing hooks with useCallback and useMemo, and fine-tuning asset loading (fonts, analytics), resulting in a 25-28% reduction in initial bundle size on key routes.


Open in Cursor Open in Web

This commit introduces several optimizations and dependency updates across the project. Key changes include:

- **Component Optimizations:**
    - `Cocktail.js`: Implemented dynamic import for `CopyToClipboard` and memoized the component to prevent unnecessary re-renders.
    - `Layout.js`: Memoized the `Layout` component and optimized font loading.
    - `Results.js`: Memoized the `Results` component and optimized cocktail sorting logic.
    - `Suggestion.js`: Memoized the `Suggestion` component and optimized keyword selection logic.
    - `Suggestions.js`: Memoized the `Suggestions` component.

- **Dependency Updates:**
    - Updated `react`, `react-dom`, and `react-select` to newer versions.
    - Replaced `@emotion/core` with `@emotion/react`.
    - Updated `next` to a newer version.
    - Updated `sass` to a newer version.

- **Code Improvements:**
    - Added `useCallback` for event handlers in `Layout.js` for performance.
    - Used `useMemo` in `Suggestion.js` for optimized keyword value calculation.
    - Added `rel="noopener noreferrer"` to external links for security.
    - Updated `Script` component usage in `Layout.js` for better performance.

These changes aim to improve application performance, maintainability, and security.

Co-authored-by: bnstnfld <bnstnfld@gmail.com>
@cursor

cursor Bot commented Dec 18, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel

vercel Bot commented Dec 18, 2025

Copy link
Copy Markdown

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

Project Deployment Review Updated (UTC)
901-next-o6d1 Ready Ready Preview, Comment Dec 18, 2025 4:12am

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.

2 participants