Inconsistent error handling between server and client results in content flash

Đang mở
#8,590 0 bình luận 1 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Sheraff đang làm issue này rồi.

Từ ngày 3/10/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

Which project does this relate to?

Start

Describe the bug

When a loader throws an error

export const Route = createFileRoute('/')({
  loader: async () => {
    throw new Error('boom');
  },

and createRootRoute specifies an errorComponent,

export const Route = createRootRoute({
  shellComponent: RootShell,
  component: () => (
    <div>
      Root component <Outlet />
    </div>
  ),
  errorComponent: () => <div>Error</div>,
});

the server renders the root route, and the outlet uses Tanstack Router's default error component (red and white).

Image

The client renders the same error using createRootRoute's error component.

Image

The result is a flash when the page loads. Gif below

Complete minimal reproducer

https://stackblitz.com/edit/vitejs-vite-h8o4lw1b

Steps to Reproduce the Bug

Refresh the page

Expected behavior

No flash. Server and client should agree on either rendering the root component or rendering the root error component.

Screenshots or Videos
Image
Platform
  • Router version: 1.170.41 (latest)
  • Start version: 1.168.60 (latest)
  • OS: Windows
  • Browser: Chrome
  • Browser Version: 154.0.8037.95
  • Bundler: vite
  • Bundler Version: 8.3.2 (latest)
Additional context

No response

Ngôn ngữ chính
TypeScript
Star
15.3k
Fork
1.9k
Merge trung bình
1 ngày 5 giờ
Pull request đã merge (30 ngày)
46

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TanStack/router

Tất cả issue của TanStack/router

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.