feat: add skeleton loading UI for tracker data#246
Conversation
✅ Deploy Preview for github-spy ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe Tracker component's loading UI now renders a TableContainer/Paper with the existing table header and multiple MUI Skeleton rows (including circular/title and per-cell skeletons) instead of the previous centered spinner or earlier placeholder. ChangesLoading State UX Enhancement
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 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. Comment |
There was a problem hiding this comment.
🎉 Thank you @KunjalVanra for your contribution. Please make sure your PR follows https://github.com/GitMetricsLab/github_tracker/blob/main/CONTRIBUTING.md#-pull-request-guidelines
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@src/pages/Tracker/Tracker.tsx`:
- Around line 283-348: The loading branch that renders the placeholder rows (the
[...Array(6)].map(...) block inside TableContainer) must include the same scroll
wrapper and pagination area used in the loaded branch so layout doesn't shift;
wrap the TableContainer or the Table in the same scroll container component (the
same Box/div with the scrolling styles) and add a stub pagination component or
placeholder element matching the real pagination (e.g., same height and
structure as the TablePagination used when data is loaded) so spacing is
identical between loading and loaded states. Ensure you modify the loading
branch where TableContainer and the skeleton rows are rendered to reuse the same
scroll wrapper and pagination placeholders as the loaded branch.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3f8f2268-05e8-418d-aba2-5436863f000e
📒 Files selected for processing (1)
src/pages/Tracker/Tracker.tsx
| <TableContainer component={Paper}> | ||
| <Table size="small"> | ||
| <TableHead> | ||
| <TableRow> | ||
| <TableCell>Title</TableCell> | ||
| <TableCell align="center">Repository</TableCell> | ||
| <TableCell align="center">State</TableCell> | ||
| <TableCell>Created</TableCell> | ||
| </TableRow> | ||
| </TableHead> | ||
|
|
||
| <TableBody> | ||
| {[...Array(6)].map((_, index) => ( | ||
| <TableRow key={index}> | ||
| <TableCell> | ||
| <Box display="flex" alignItems="center" gap={1}> | ||
| <Skeleton | ||
| variant="circular" | ||
| width={20} | ||
| height={20} | ||
| animation="wave" | ||
| /> | ||
|
|
||
| <Skeleton | ||
| variant="text" | ||
| width="80%" | ||
| height={30} | ||
| animation="wave" | ||
| /> | ||
| </Box> | ||
| </TableCell> | ||
|
|
||
| <TableCell align="center"> | ||
| <Skeleton | ||
| variant="text" | ||
| width={100} | ||
| height={25} | ||
| animation="wave" | ||
| sx={{ mx: "auto" }} | ||
| /> | ||
| </TableCell> | ||
|
|
||
| <TableCell align="center"> | ||
| <Skeleton | ||
| variant="rounded" | ||
| width={70} | ||
| height={25} | ||
| animation="wave" | ||
| sx={{ mx: "auto" }} | ||
| /> | ||
| </TableCell> | ||
|
|
||
| <TableCell> | ||
| <Skeleton | ||
| variant="text" | ||
| width={90} | ||
| height={25} | ||
| animation="wave" | ||
| /> | ||
| </TableCell> | ||
| </TableRow> | ||
| ))} | ||
| </TableBody> | ||
| </Table> | ||
| </TableContainer> | ||
| ) : ( |
There was a problem hiding this comment.
Keep loading and loaded table containers structurally consistent.
The loading branch omits the scroll wrapper and pagination area used in the loaded branch, so the page height shifts when data arrives. Add matching container/pagination placeholders to keep layout stable.
Proposed patch
- {loading ? (
- <TableContainer component={Paper}>
+ {loading ? (
+ <Box sx={{ maxHeight: "400px", overflowY: "auto" }}>
+ <TableContainer component={Paper}>
<Table size="small">
@@
<TableBody>
@@
</TableBody>
</Table>
+ <TablePagination
+ component="div"
+ count={0}
+ page={0}
+ onPageChange={() => {}}
+ rowsPerPage={ROWS_PER_PAGE}
+ rowsPerPageOptions={[ROWS_PER_PAGE]}
+ labelDisplayedRows={() => " "}
+ backIconButtonProps={{ disabled: true }}
+ nextIconButtonProps={{ disabled: true }}
+ />
</TableContainer>
+ </Box>
) : (📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <TableContainer component={Paper}> | |
| <Table size="small"> | |
| <TableHead> | |
| <TableRow> | |
| <TableCell>Title</TableCell> | |
| <TableCell align="center">Repository</TableCell> | |
| <TableCell align="center">State</TableCell> | |
| <TableCell>Created</TableCell> | |
| </TableRow> | |
| </TableHead> | |
| <TableBody> | |
| {[...Array(6)].map((_, index) => ( | |
| <TableRow key={index}> | |
| <TableCell> | |
| <Box display="flex" alignItems="center" gap={1}> | |
| <Skeleton | |
| variant="circular" | |
| width={20} | |
| height={20} | |
| animation="wave" | |
| /> | |
| <Skeleton | |
| variant="text" | |
| width="80%" | |
| height={30} | |
| animation="wave" | |
| /> | |
| </Box> | |
| </TableCell> | |
| <TableCell align="center"> | |
| <Skeleton | |
| variant="text" | |
| width={100} | |
| height={25} | |
| animation="wave" | |
| sx={{ mx: "auto" }} | |
| /> | |
| </TableCell> | |
| <TableCell align="center"> | |
| <Skeleton | |
| variant="rounded" | |
| width={70} | |
| height={25} | |
| animation="wave" | |
| sx={{ mx: "auto" }} | |
| /> | |
| </TableCell> | |
| <TableCell> | |
| <Skeleton | |
| variant="text" | |
| width={90} | |
| height={25} | |
| animation="wave" | |
| /> | |
| </TableCell> | |
| </TableRow> | |
| ))} | |
| </TableBody> | |
| </Table> | |
| </TableContainer> | |
| ) : ( | |
| <Box sx={{ maxHeight: "400px", overflowY: "auto" }}> | |
| <TableContainer component={Paper}> | |
| <Table size="small"> | |
| <TableHead> | |
| <TableRow> | |
| <TableCell>Title</TableCell> | |
| <TableCell align="center">Repository</TableCell> | |
| <TableCell align="center">State</TableCell> | |
| <TableCell>Created</TableCell> | |
| </TableRow> | |
| </TableHead> | |
| <TableBody> | |
| {[...Array(6)].map((_, index) => ( | |
| <TableRow key={index}> | |
| <TableCell> | |
| <Box display="flex" alignItems="center" gap={1}> | |
| <Skeleton | |
| variant="circular" | |
| width={20} | |
| height={20} | |
| animation="wave" | |
| /> | |
| <Skeleton | |
| variant="text" | |
| width="80%" | |
| height={30} | |
| animation="wave" | |
| /> | |
| </Box> | |
| </TableCell> | |
| <TableCell align="center"> | |
| <Skeleton | |
| variant="text" | |
| width={100} | |
| height={25} | |
| animation="wave" | |
| sx={{ mx: "auto" }} | |
| /> | |
| </TableCell> | |
| <TableCell align="center"> | |
| <Skeleton | |
| variant="rounded" | |
| width={70} | |
| height={25} | |
| animation="wave" | |
| sx={{ mx: "auto" }} | |
| /> | |
| </TableCell> | |
| <TableCell> | |
| <Skeleton | |
| variant="text" | |
| width={90} | |
| height={25} | |
| animation="wave" | |
| /> | |
| </TableCell> | |
| </TableRow> | |
| ))} | |
| </TableBody> | |
| </Table> | |
| <TablePagination | |
| component="div" | |
| count={0} | |
| page={0} | |
| onPageChange={() => {}} | |
| rowsPerPage={ROWS_PER_PAGE} | |
| rowsPerPageOptions={[ROWS_PER_PAGE]} | |
| labelDisplayedRows={() => " "} | |
| backIconButtonProps={{ disabled: true }} | |
| nextIconButtonProps={{ disabled: true }} | |
| /> | |
| </TableContainer> | |
| </Box> | |
| ) : ( |
🤖 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 `@src/pages/Tracker/Tracker.tsx` around lines 283 - 348, The loading branch
that renders the placeholder rows (the [...Array(6)].map(...) block inside
TableContainer) must include the same scroll wrapper and pagination area used in
the loaded branch so layout doesn't shift; wrap the TableContainer or the Table
in the same scroll container component (the same Box/div with the scrolling
styles) and add a stub pagination component or placeholder element matching the
real pagination (e.g., same height and structure as the TablePagination used
when data is loaded) so spacing is identical between loading and loaded states.
Ensure you modify the loading branch where TableContainer and the skeleton rows
are rendered to reuse the same scroll wrapper and pagination placeholders as the
loaded branch.
|
@KunjalVanra - pls resolve conflicts |
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)
src/pages/Tracker/Tracker.tsx (1)
24-32:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winRemove duplicate
Skeletonimport to fix module parse failure.
Skeletonis imported twice from@mui/material(lines 24 and 31), creating a duplicate binding that breaks compilation.Proposed fix
import { Container, Box, TextField, Button, Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TablePagination, Link, Alert, Skeleton, Tabs, Tab, Select, MenuItem, FormControl, InputLabel, - Skeleton, Typography, } from "`@mui/material`";🤖 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 `@src/pages/Tracker/Tracker.tsx` around lines 24 - 32, The import list contains a duplicate binding for Skeleton which breaks compilation; edit the module's import statement that currently lists "Skeleton" twice (alongside Tabs, Tab, Select, MenuItem, FormControl, InputLabel, Typography) and remove the redundant Skeleton entry so each symbol is imported only once.
🤖 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.
Outside diff comments:
In `@src/pages/Tracker/Tracker.tsx`:
- Around line 24-32: The import list contains a duplicate binding for Skeleton
which breaks compilation; edit the module's import statement that currently
lists "Skeleton" twice (alongside Tabs, Tab, Select, MenuItem, FormControl,
InputLabel, Typography) and remove the redundant Skeleton entry so each symbol
is imported only once.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 754b5274-f6b0-4c67-8d54-6ede08f9fad8
📒 Files selected for processing (1)
src/pages/Tracker/Tracker.tsx
✨ Changes Added
🧪 Tested
📸 Preview
Summary by CodeRabbit