Skip to content

fix: GitHub stars shows [object Response] when toggling list/grid view#24

Open
AbhiVarde wants to merge 1 commit intoappwrite:mainfrom
AbhiVarde:fix/github-stars-object-response
Open

fix: GitHub stars shows [object Response] when toggling list/grid view#24
AbhiVarde wants to merge 1 commit intoappwrite:mainfrom
AbhiVarde:fix/github-stars-object-response

Conversation

@AbhiVarde
Copy link

@AbhiVarde AbhiVarde commented Mar 13, 2026

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

Header was rendered inside shellComponent which 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 RootDocument into:

  • RootShell (shellComponent): static HTML shell only, no loader data
  • RootLayout (component): Header, Outlet, Footer where useLoaderData() works correctly

No styles, logic, or other behavior changed.

Summary by CodeRabbit

  • Refactor

    • Restructured layout and routing architecture for improved code organization.
  • Style

    • Updated text wrapping behavior for improved content display.

@appwrite
Copy link

appwrite bot commented Mar 13, 2026

Appwrite Arena

Project ID: appwrite-arena

Sites (1)
Site Status Logs Preview QR
 Arena
arena
Ready Ready View Logs Preview URL QR Code

Tip

HTTPS and SSL certificates are handled automatically for all your Sites

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 26844f69-71ae-48d5-87a8-ada596a95d44

📥 Commits

Reviewing files that changed from the base of the PR and between b423d9a and 41374a1.

📒 Files selected for processing (1)
  • src/routes/__root.tsx

Walkthrough

The root route component in src/routes/__root.tsx is refactored to restructure the layout component hierarchy. The change separates shell HTML rendering from layout rendering: RootDocument is renamed to RootShell and now renders only the HTML scaffold; a new RootLayout component is introduced to handle header, outlet, and footer rendering. The Route configuration is updated to use RootShell as shellComponent and adds RootLayout as the component. Outlet is imported and used within RootLayout to render routed content. A className adjustment changes overflow-wrap:anywhere to wrap-anywhere in the Body element.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the bug being fixed (GitHub stars displaying as [object Response]) and the condition that triggers it (toggling list/grid view), making it directly related to the main change in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.

OpenGrep is compatible with Semgrep configurations. Add an opengrep.yml or semgrep.yml configuration file to your project to enable OpenGrep analysis.

@Meldiron Meldiron requested a review from Copilot March 13, 2026 13:46
}

function RootLayout() {
const stars = Route.useLoaderData();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Love the effort! But it seems we still have same problem on preview 🤔 Feel free to PM me if you have som ideas/questions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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} />

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 as shellComponent) and a dynamic RootLayout (used as component) that reads loader data and renders Header/Outlet/Footer.
  • Moved Header (and Footer) rendering into the route component so Route.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)]">
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[overflow-wrap:anywhere] and wrap-anywhere are equivalent canonical classes, no style change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants