Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Loading for lazy-load strategy is not showing in react-router v7

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

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

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu với packages/ra-ui-materialui/src/layout/Layout.tsx, quanh ranh giới Suspense được liên kết trong issue, sau đó tái hiện thao tác điều hướng lazy-route với mạng chậm sau khi nâng cấp lên react-router v7. So sánh hành vi với chiến lược react-router được liên kết; hoàn tất khi fallback LoadingComp được khởi chạy trong lúc component lazy đang tải.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

needs more info

What you were expecting:
RA lazy strategy with loading should work properly after update to react-router v7.

What happened instead:

Loading component not initiate in Suspense when update my App to react-router v7.

Steps to reproduce:

  1. Create router that import lazy components;
  2. Navigate with slow network to understand the problem, setted in the Browser;
  3. Loading componente will not be initiated by RA Suspense;

This strategy solved my problem:
https://github.com/remix-run/react-router/issues/12474

I think that we can put key inside the Suspense to solve the problem: https://github.com/marmelab/react-admin/blob/377f29f0c4357281838e978fa613acb29c6dbe2b/packages/ra-ui-materialui/src/layout/Layout.tsx#L70

like:

function MyComp() {
  const location = useLocation()

  return (
    <Suspense 
      fallback={<LoadingComp text="Loading..." />}
      key={location.key}
    >
      <MyAwaitOrUseComp />
    </Suspense>
  )
}

Other information:

Environment

  • React-admin version: 5.8.4
  • Last version that did not exhibit the issue (if applicable):
  • React version: v18
  • Browser: chrome
  • Stack trace (in case of a JS error):
Ngôn ngữ chính
TypeScript
Star
27k
Fork
5.5k
Merge trung bình
1 ngày 3 phút
Pull request đã merge (30 ngày)
32

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

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 marmelab/react-admin

Tất cả issue của marmelab/react-admin

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.