-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: prevent flickering of table ui on empty data #425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe pull request involves removing loading state management from two React components: Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/components/robot/RecordingsTable.tsx (2)
223-223: LGTM! Consider adding a skeleton loader for better UX.The removal of loading state helps prevent flickering, but you might want to consider adding a skeleton loader to provide visual feedback during data fetching without causing layout shifts.
const RecordingsTable = ({ ... }) => { + const [isInitialLoad, setIsInitialLoad] = React.useState(true); ... useEffect(() => { if (rows.length === 0) { - fetchRecordings(); + fetchRecordings().finally(() => setIsInitialLoad(false)); } }, [fetchRecordings]); return ( ... <TableBody> + {isInitialLoad ? ( + Array.from({ length: 3 }).map((_, index) => ( + <TableRow key={`skeleton-${index}`}> + {columns.map((column) => ( + <TableCell key={column.id}> + <Skeleton animation="wave" /> + </TableCell> + ))} + </TableRow> + )) + ) : ( {visibleRows.map((row) => ( <TableRowMemoized key={row.id} row={row} columns={columns} handlers={handlers} /> ))} + )} </TableBody> ); };
358-359: Consider pre-calculating table dimensions to prevent CLS.To further prevent layout shifts and flickering, you could pre-calculate and set fixed dimensions for the table container based on the viewport.
- <TableContainer component={Paper} sx={{ width: '100%', overflow: 'hidden', marginTop: '15px' }}> + <TableContainer + component={Paper} + sx={{ + width: '100%', + overflow: 'hidden', + marginTop: '15px', + height: `calc(100vh - 200px)`, // Adjust based on your layout + minHeight: '400px' + }}>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/robot/RecordingsTable.tsx(2 hunks)src/components/run/RunsTable.tsx(0 hunks)
💤 Files with no reviewable changes (1)
- src/components/run/RunsTable.tsx
🔇 Additional comments (1)
src/components/robot/RecordingsTable.tsx (1)
358-383: LGTM! Clean table structure with performance optimizations.The table structure is well-organized and uses memoization effectively. The direct rendering without loading states helps prevent layout shifts and flickering.
Summary by CodeRabbit
Bug Fixes
Refactor
The changes focus on removing loading spinners and simplifying the rendering of recordings and runs tables, which may impact the user's perception of data loading.