Server-Side Rendering#76
Conversation
Оптимизация шрифтов в Next.js работает так, что при сборке он качает их себе локально. В проде, когда юзер открывает страницу, шрифты будут отправляться юзеру напрямую, без надобности отправлять запрос в Google Fonts. До этого коммита у нас получилось так, что юзер запрашивал шрифты И у нашего сайта И у Google Fonts.
There was a problem hiding this comment.
Pull Request Overview
This PR implements Server-Side Rendering (SSR) for all possible pages in the application. The key objective is to reduce client-side rendering load by having the server handle most of the page rendering, leaving only dynamic content to be rendered on the client.
- Migrated multiple pages to SSR with proper data fetching at the server level
- Refactored profile routing to use dynamic IDs instead of client-side redirects
- Removed client-side dependency patterns and replaced with server actions
- Updated CSS variables and styling optimizations
Reviewed Changes
Copilot reviewed 73 out of 77 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/server-actions/actions/getPersonIdFromToken.action.ts | New server action to extract person ID from JWT token |
| src/server-actions/middleware/utils/jwt-verify.ts | Simplified JWT verification by removing explicit type annotation |
| src/app/(auth)/(withMenuNavigation)/profile/page.tsx | Changed to redirect to user-specific profile URL using server-side token parsing |
| src/app/(auth)/(withMenuNavigation)/events/page.tsx | Converted to SSR with server-side data fetching |
| src/app/(auth)/(withMenuNavigation)/clubs/[id]/page.tsx | Added SSR support with proper error handling |
| Multiple component files | Reorganized imports and removed client-side dependencies for SSR compatibility |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| const ClubReportDialogDynamic = dynamic(() => import('@/components/ClubComponents/ClubReportDialog'), { | ||
| ssr: false, | ||
| }); | ||
| const ClubReportDialogDynamic = dynamic(() => import('@/components/ClubComponents/ClubReportDialog')); |
There was a problem hiding this comment.
Тут вроде без ssr: false возникает ошибка в консоли
There was a problem hiding this comment.
И вместе с ней тоже, так как это серверный компонент, но без него сборка проходит. Предлагаю пока оставить как есть и посмотреть как это в проде будет работать.
В общем
Реализован SSR для всех возможных страниц. Чтобы не отдавать на рендер всю страницу клиенту, я сделал так, что большая часть страницы рендерится на сервере, и уже динамический контент рендерится на клиенте.
Сравнение
SizeиFirst Load JSСтарый
Новый