App first-load performance#15
Draft
bstanfield wants to merge 1 commit into
Draft
Conversation
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 Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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), applyingReact.memofor efficient re-renders, optimizing hooks withuseCallbackanduseMemo, and fine-tuning asset loading (fonts, analytics), resulting in a 25-28% reduction in initial bundle size on key routes.