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 state UI is replaced with a skeletonized table structure. The ChangesLoading State UX Enhancement
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
✨ Changes Added
🧪 Tested
📸 Preview