Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough本PR为应用添加了多语言页面浏览计数统计功能。涵盖四种语言的国际化文案、一个新的基础设施API层、一个页面浏览计数UI组件,以及在事件详情页和组织详情页上的集成。 Changes页面浏览计数功能
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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. Review rate limit: 0/1 reviews remaining, refill in 49 minutes.Comment |
📦 Next.js Bundle Analysis for furrycons-siteThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
| Page | Size (compressed) |
|---|---|
global |
358.72 KB (🟡 +399 B) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
Two Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
| Page | Size (compressed) | First Load | % of Budget (350 KB) |
|---|---|---|---|
/[organization] |
8.92 KB |
367.63 KB | 105.04% (🟡 +0.07%) |
/[organization]/[slug] |
12.84 KB |
371.56 KB | 106.16% (🟡 +0.07%) |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/PageviewHeatTag/index.tsx`:
- Around line 6-10: The locale mapping for number formatting is too broad:
intlLocale currently maps any non-"en"/"zh-Hant" to "zh-Hans", causing languages
like "ru" to be formatted with Chinese rules; update the intlLocale logic (the
locale variable and intlLocale constant used with new Intl.NumberFormat) to only
map explicit known overrides (e.g., map "en" -> "en-US", "zh-Hant" -> "zh-Hant",
"zh-Hans" -> "zh-Hans") and otherwise pass through the incoming locale (or a
safe fallback like "en-US") so Russian ("ru") and other locales use their
correct formatting.
In `@src/pages/`[organization]/[slug].tsx:
- Around line 197-200: The pageview call (InfraAPI.getPageview) is currently
awaited alongside EventsAPI.getEventDetail and any failure/404 from getPageview
causes the whole page to be treated as missing; change this so pageview is
optional by isolating its error handling—either use Promise.allSettled for the
pair or wrap InfraAPI.getPageview in a try/catch and set pv to null/undefined on
error (while still throwing or handling errors from EventsAPI.getEventDetail
normally). Apply the same change to the second occurrence around the 240–245
block so that event retrieval (EventsAPI.getEventDetail) controls 404 behavior
but pageview failures degrade silently.
In `@src/pages/`[organization]/index.tsx:
- Around line 318-321: The pageview fetch (InfraAPI.getPageview) is currently
combined with the organization detail fetch via Promise.all so any pageview
failure can trigger the shared 404/abort logic; change this so
OrganizationsAPI.getOrganizationDetail(reqParamsParseResult.organization) is
awaited and validated independently, then call
InfraAPI.getPageview(pageviewPath) in a separate try/catch (or fire-and-forget
with error handling) so its errors are caught and logged but do not cause the
organization detail path (and 404 handling) to run; apply the same decoupling
change where the same pattern occurs around the block that currently spans lines
395-400.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 005c129e-7ac3-4bcf-b743-5d21a77f1493
📒 Files selected for processing (8)
public/locales/en/common.jsonpublic/locales/ru/common.jsonpublic/locales/zh-Hans/common.jsonpublic/locales/zh-Hant/common.jsonsrc/api/infra.tssrc/components/PageviewHeatTag/index.tsxsrc/pages/[organization]/[slug].tsxsrc/pages/[organization]/index.tsx
| const intlLocale = locale === "en" ? "en-US" : locale === "zh-Hant" ? "zh-Hant" : "zh-Hans"; | ||
| return new Intl.NumberFormat(intlLocale, { | ||
| notation: count >= 10_000 ? "compact" : "standard", | ||
| maximumFractionDigits: 1, | ||
| }).format(count); |
There was a problem hiding this comment.
修复 locale 映射默认分支,避免俄语页面被格式化成中文数字样式。
当前分支把所有非 en/zh-Hant 语言都强制映射到 zh-Hans;新增 ru 后会出现错误本地化展示。
💡 建议修改
function formatCount(count: number, locale: string): string {
- const intlLocale = locale === "en" ? "en-US" : locale === "zh-Hant" ? "zh-Hant" : "zh-Hans";
+ const intlLocaleMap: Record<string, string> = {
+ en: "en-US",
+ "zh-Hant": "zh-Hant",
+ "zh-Hans": "zh-Hans",
+ ru: "ru-RU",
+ };
+ const intlLocale = intlLocaleMap[locale] ?? locale;
return new Intl.NumberFormat(intlLocale, {
notation: count >= 10_000 ? "compact" : "standard",
maximumFractionDigits: 1,
}).format(count);
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/components/PageviewHeatTag/index.tsx` around lines 6 - 10, The locale
mapping for number formatting is too broad: intlLocale currently maps any
non-"en"/"zh-Hant" to "zh-Hans", causing languages like "ru" to be formatted
with Chinese rules; update the intlLocale logic (the locale variable and
intlLocale constant used with new Intl.NumberFormat) to only map explicit known
overrides (e.g., map "en" -> "en-US", "zh-Hant" -> "zh-Hant", "zh-Hans" ->
"zh-Hans") and otherwise pass through the incoming locale (or a safe fallback
like "en-US") so Russian ("ru") and other locales use their correct formatting.
📦 Next.js Bundle Analysis for furrycons-siteThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
| Page | Size (compressed) |
|---|---|
global |
358.72 KB (🟡 +403 B) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
Two Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
| Page | Size (compressed) | First Load | % of Budget (350 KB) |
|---|---|---|---|
/[organization] |
8.92 KB |
367.64 KB | 105.04% (🟡 +0.07%) |
/[organization]/[slug] |
12.84 KB |
371.57 KB | 106.16% (🟡 +0.07%) |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
Summary by CodeRabbit
新功能
国际化