Conversation
Memoize defaultTableQuery and explicitly reset sort/group_by in onDisplaySettingsReset so reset always restores defaultSort and no grouping, regardless of initial query prop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add hasActiveQuery util to check for active filters, search, or non-default sort/grouping. Use it in content and virtualized-content to correctly distinguish zero state from empty state. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR refactors the data-table component's zero-state and empty-state detection logic by introducing a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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 |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/raystack/components/data-table/__tests__/data-table.test.tsx`:
- Around line 3-14: The test suite replaces global.IntersectionObserver in
beforeAll but doesn't restore it; capture the original value (e.g., const
_origIntersectionObserver = global.IntersectionObserver) before mocking and
restore it in an afterAll teardown by setting global.IntersectionObserver =
_origIntersectionObserver, keeping the mock implementation created with
vi.fn().mockImplementation intact and referencing beforeAll and afterAll in the
test file to avoid leaking the mock to other tests.
In `@packages/raystack/components/data-table/utils/index.tsx`:
- Around line 170-171: The current hasFilters computation only checks
tableQuery.filters.length which treats empty filter rows as active; update the
logic used by hasFilters (and any dependent hasActiveQuery) to detect only
filters with usable values by verifying at least one entry in tableQuery.filters
has a non-null, non-empty value (handle empty strings, empty arrays, and
null/undefined) rather than just checking array length; locate and modify the
hasFilters assignment in index.tsx to use Array.prototype.some on
tableQuery.filters to determine true activity.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c3da4730-8ccd-4185-a970-ec067f98539d
📒 Files selected for processing (5)
packages/raystack/components/data-table/__tests__/data-table.test.tsxpackages/raystack/components/data-table/components/content.tsxpackages/raystack/components/data-table/components/virtualized-content.tsxpackages/raystack/components/data-table/data-table.tsxpackages/raystack/components/data-table/utils/index.tsx
Summary
defaultTableQueryand explicitly setting sort/group_by to defaults inonDisplaySettingsResethasActiveQueryutil, preventing incorrect zero state when sort or grouping is modifieddefaultSortto all existing tests missing itTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Bug Fixes
Improvements