feat: add 'use client' directive to client rendered components#735
feat: add 'use client' directive to client rendered components#735paanSinghCoder wants to merge 2 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR systematically adds the Possibly related issues
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/raystack/components/data-table/hooks/useDataTable.tsx (1)
1-14:⚠️ Potential issue | 🔴 CriticalAdd 'use client' directive to useFilters.tsx.
useFilters.tsxcallsuseDataTable()(line 11), which is imported from a client module marked with 'use client'. In React Server Components, any module importing from a client boundary must also be marked as a client component. All other files importinguseDataTable(search.tsx, toolbar.tsx, virtualized-content.tsx, filters.tsx, content.tsx, display-settings.tsx) have the directive; useFilters.tsx is the only missing one.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/raystack/components/data-table/hooks/useDataTable.tsx` around lines 1 - 14, Add the "use client" directive to the top of useFilters.tsx because it imports the client-bound useDataTable() hook; open useFilters.tsx and insert 'use client' as the first line so the module is treated as a client component (this aligns it with other files like search.tsx and toolbar.tsx that already import useDataTable).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/raystack/components/data-table/hooks/useDataTable.tsx`:
- Around line 1-14: Add the "use client" directive to the top of useFilters.tsx
because it imports the client-bound useDataTable() hook; open useFilters.tsx and
insert 'use client' as the first line so the module is treated as a client
component (this aligns it with other files like search.tsx and toolbar.tsx that
already import useDataTable).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 09aab64b-c4dd-4340-b506-ee3f924ec599
📒 Files selected for processing (18)
packages/raystack/components/alert-dialog/alert-dialog.tsxpackages/raystack/components/avatar/avatar.tsxpackages/raystack/components/button/button.tsxpackages/raystack/components/combobox/combobox.tsxpackages/raystack/components/data-table/hooks/useDataTable.tsxpackages/raystack/components/dialog/dialog.tsxpackages/raystack/components/drawer/drawer.tsxpackages/raystack/components/flex/flex.tsxpackages/raystack/components/grid/grid-item.tsxpackages/raystack/components/grid/grid.tsxpackages/raystack/components/menu/menu.tsxpackages/raystack/components/radio/radio.tsxpackages/raystack/components/select/select.tsxpackages/raystack/components/separator/separator.tsxpackages/raystack/components/switch/switch.tsxpackages/raystack/components/tabs/tabs.tsxpackages/raystack/components/toast/toast.tsxpackages/raystack/components/tooltip/tooltip.tsx
rohanchkrabrty
left a comment
There was a problem hiding this comment.
Not all components require use client
Please add the directive to components that should be client components only
|
@rohanchkrabrty Flex and Grid, both uses useRender hook thus added the use client. Removed for the import only files. |
|
@paanSinghCoder None of the changed components require the directive. Components which don't need since they are just wrapping Base UI Primitives and has no interactivity.
Remaining components which use
Base UI |
Description
refactor: Add 'use-client' for components with client side React features like hooks, ref, etc.
Type of Change
How Has This Been Tested?
manual
Checklist:
Screenshots (if appropriate):
[Add screenshots here]
Related Issues
[Link any related issues here using #issue-number]