[React Doctor] prefer-use-sync-external-store: useState "activeTab" is synchronized with an external store via useEffect — r... (2 occurrences) - #10553
Conversation
…n tab components (fixes #27946)
|
Warning Review limit reached
Next review available in: 5 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughChangesHash-based tab subscription
Suggested reviewers: Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
features/admin.console-settings.v1/components/console-settings-tabs.tsx (1)
203-204: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMove type aliases outside the component function.
While TypeScript erases types during compilation so there is no runtime penalty, defining type aliases inside a component function clutters the runtime logic block and is considered atypical styling. Consider moving
SubscribeCallbackandUnsubscribeFunctionoutside the component scope.
features/admin.console-settings.v1/components/console-settings-tabs.tsx#L203-L204: Move the type definitions above theConsoleSettingsTabscomponent definition.features/admin.tenants.v1/components/system-settings/system-settings-tabs.tsx#L118-L119: Move the type definitions above theSystemSettingsTabscomponent definition.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@features/admin.console-settings.v1/components/console-settings-tabs.tsx` around lines 203 - 204, Move the SubscribeCallback and UnsubscribeFunction type aliases above the ConsoleSettingsTabs component definition in features/admin.console-settings.v1/components/console-settings-tabs.tsx#L203-L204 and above the SystemSettingsTabs component definition in features/admin.tenants.v1/components/system-settings/system-settings-tabs.tsx#L118-L119, keeping their definitions unchanged and outside the component bodies.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@features/admin.console-settings.v1/components/console-settings-tabs.tsx`:
- Around line 203-204: Move the SubscribeCallback and UnsubscribeFunction type
aliases above the ConsoleSettingsTabs component definition in
features/admin.console-settings.v1/components/console-settings-tabs.tsx#L203-L204
and above the SystemSettingsTabs component definition in
features/admin.tenants.v1/components/system-settings/system-settings-tabs.tsx#L118-L119,
keeping their definitions unchanged and outside the component bodies.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: f83b6221-b006-4fb9-bf90-02c429a27258
📒 Files selected for processing (2)
features/admin.console-settings.v1/components/console-settings-tabs.tsxfeatures/admin.tenants.v1/components/system-settings/system-settings-tabs.tsx
…n tab components (fixes #27946)
Purpose
Replaces the manual
useState+useEffecthash-change listener pattern withuseSyncExternalStoreinConsoleSettingsTabsandSystemSettingsTabs. This resolves a React Doctorprefer-use-sync-external-storewarning and avoids potential tearing during concurrent renders, since the active tab is now derived directly from the URL hash via React's render/commit cycle instead of being manually synced through a side effect.No behavioral or visual changes — tab switching and URL hash syncing work exactly as before.
Related Issues
Related PRs
Checklist
Security checks
Developer Checklist (Mandatory)
product-isissue to track any behavioral change or migration impact.