fix: GitHub stars shows [object Response] when toggling list/grid view#24
fix: GitHub stars shows [object Response] when toggling list/grid view#24AbhiVarde wants to merge 1 commit intoappwrite:mainfrom
Conversation
Appwrite ArenaProject ID: Tip HTTPS and SSL certificates are handled automatically for all your Sites |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe root route component in Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.OpenGrep is compatible with Semgrep configurations. Add an |
| } | ||
|
|
||
| function RootLayout() { | ||
| const stars = Route.useLoaderData(); |
There was a problem hiding this comment.
thanks! it works perfectly on my side locally. if it still doesn't work on preview, maybe we can try:
<Header stars={typeof stars === "number" ? stars : 0} />
There was a problem hiding this comment.
Pull request overview
Refactors the TanStack Router root route to ensure the GitHub stars value in the Header updates correctly on client-side navigation (e.g., when toggling list/grid view), avoiding [object Response] being displayed.
Changes:
- Split the root document into a static
RootShell(used asshellComponent) and a dynamicRootLayout(used ascomponent) that reads loader data and rendersHeader/Outlet/Footer. - Moved
Header(andFooter) rendering into the routecomponentsoRoute.useLoaderData()updates on navigation. - Replaced the body text-wrapping class from an arbitrary CSS utility to
wrap-anywhere.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <HeadContent /> | ||
| </head> | ||
| <body className="flex min-h-screen flex-col font-sans antialiased [overflow-wrap:anywhere] selection:bg-[rgba(253,54,110,0.2)]"> | ||
| <body className="flex min-h-screen flex-col font-sans antialiased wrap-anywhere selection:bg-[rgba(253,54,110,0.2)]"> |
There was a problem hiding this comment.
[overflow-wrap:anywhere] and wrap-anywhere are equivalent canonical classes, no style change.


Problem
Toggling between list and grid view causes the GitHub star count in the header to display
[object Response]instead of the actual number.Root Cause
Headerwas rendered insideshellComponentwhich doesn't re-render on client-side navigation. When the view toggle triggers a route transition,useLoaderData()returns the raw unresolved object instead of the number.Fix
Split
RootDocumentinto:RootShell(shellComponent): static HTML shell only, no loader dataRootLayout(component): Header, Outlet, Footer whereuseLoaderData()works correctlyNo styles, logic, or other behavior changed.
Summary by CodeRabbit
Refactor
Style