Performance improvements, bundle optimization#734
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughCentralizes markdown-to-HTML via a new utility, adds local Unicons components and webpack aliasing, increases ISR revalidation to 300s for dynamic pages, implements Mattermost per-user left-channel tracking, adds Next.js bundle-analyzer support, relocates some CSS imports, and updates Sentry and cache headers. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Bootstrap as Bootstrap Handler
participant MMAPI as Mattermost API
participant Props as User Props Storage
Note over User,MMAPI: User triggers join/bootstrap or leave flows
User->>Bootstrap: Request bootstrap (subscribed communities / specific community)
Bootstrap->>Props: getUserLeftChannels(user)
Props-->>Bootstrap: leftChannels Set
loop per subscribed community
Bootstrap->>Bootstrap: normalize communityId
alt not in leftChannels
Bootstrap->>MMAPI: ensureCommunityChannelMembership(communityId, shouldAutoJoin=true)
else in leftChannels
Bootstrap->>MMAPI: ensureCommunityChannelMembership(communityId, shouldAutoJoin=false)
end
end
Note over User,MMAPI: User leaves a channel
User->>MMAPI: POST /channels/{id}/leave
MMAPI->>MMAPI: remove user from channel
alt channel matches COMMUNITY pattern
MMAPI->>Props: addUserLeftChannel(userId, channelName)
Props-->>Props: persist ecency_left_channels via PUT /users/{id}/patch
end
MMAPI-->>User: { ok: true }
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Add Cache-Control headers for static assets (immutable for hashed _next/static, 1-day for public assets) to improve Pingdom cache score - Disable Sentry BrowserTracing integration (reduces runtime overhead, was only sampling 10% of sessions anyway) - Add Sentry bundleSizeOptimizations to strip replay-related dead code - Remove enableLogs experiment
- Add data-align to style.textAlign conversion in parse-all-extensions-to-doc so editor alignment round-trips correctly through the sanitizer - Use shared COMMUNITY_CHANNEL_NAME_PATTERN in leave route instead of local duplicate - Use currentUser.id directly instead of redundant findMattermostUser call - Add displayName to generated icon components for React DevTools - Rename misleading variable in test
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/web/next.config.js (1)
169-175: Redundant header rule for/_next/static/media.The rule at line 164 (
/_next/static/:path*) already matches all paths under/_next/static/, including/media/. This second rule is unnecessary.♻️ Suggested simplification
{ // Hashed static assets (JS, CSS, media) - immutable, cache forever source: "/_next/static/:path*", headers: [ { key: "Cache-Control", value: "public, max-age=31536000, immutable" } ] - }, - { - // Fonts served by Next.js - source: "/_next/static/media/:path*", - headers: [ - { key: "Cache-Control", value: "public, max-age=31536000, immutable" } - ] },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/next.config.js` around lines 169 - 175, The route object with source "/_next/static/media/:path*" is redundant because the existing rule for "/_next/static/:path*" already covers it; remove the redundant rule (the object whose source is "/_next/static/media/:path*") or consolidate its headers into the broader "/_next/static/:path*" rule so you don't duplicate Cache-Control configuration, and keep only the single route that sets the "Cache-Control" header for "/_next/static/:path*".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/web/next.config.js`:
- Around line 169-175: The route object with source "/_next/static/media/:path*"
is redundant because the existing rule for "/_next/static/:path*" already covers
it; remove the redundant rule (the object whose source is
"/_next/static/media/:path*") or consolidate its headers into the broader
"/_next/static/:path*" rule so you don't duplicate Cache-Control configuration,
and keep only the single route that sets the "Cache-Control" header for
"/_next/static/:path*".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: dd789111-1865-411b-95b1-612bce7334ee
📒 Files selected for processing (7)
apps/web/next.config.jsapps/web/sentry.client.config.tsapps/web/src/app/api/mattermost/channels/[channelId]/leave/route.tsapps/web/src/features/tiptap-editor/functions/parse-all-extensions-to-doc.tsapps/web/src/features/ui/unicons.tsxapps/web/src/server/mattermost.tsapps/web/src/specs/features/tiptap-editor/text-color-roundtrip.spec.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/web/src/app/api/mattermost/channels/[channelId]/leave/route.ts
- apps/web/src/server/mattermost.ts
- apps/web/src/specs/features/tiptap-editor/text-color-roundtrip.spec.ts
Summary by CodeRabbit
New Features
Improvements
Chores