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

Router parsers scan the whole module, so a stray <Route> or {path} decoy becomes a route

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

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

Đánh giá

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

Hướng nghiên cứu

Read the parseRouteTags, parseRouterFallback, and parseDataRouterRoutes implementations, plus the init and route-manifest call paths. Compare how parseDataRouterRoutes identifies its router input and trace how parsed routes are merged. Done means both parsers only attribute routes owned by the actual router, or leave attribution null when it cannot be identified; add regression coverage for decoy route text outside the router.

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

Mô tả

area: setup bug

Follow-up to #226.

What is wrong

Two router parsers read path/component text from the entire module rather than the actual router:

  • parseRouteTags (used by init) scans all <Route path element> JSX in the file. A stray or commented-out <Route path="/account" element={<Decoy />} /> that is not the real router is still attributed, and via mergeParsedRoutes its non-null component wins over a data-router entry, so init can write /account -> Decoy.tsx into the authoritative sidecar.
  • parseRouterFallback (used by route-manifest) scans the whole file for path:/path=, so an unrelated { path: '/decoy' } object becomes a route.

Both predate #226 (init used parseRouteTags alone before), which is why they were left out of that PR.

Why it matters

An invented or mis-attributed route can map a changed file to a screen it does not render, which is false coverage. init writes a draft a human reviews, but route-manifest feeds discovery directly.

Fix

Scope both parsers to the actual router element or the create*Router(...) argument (as parseDataRouterRoutes now does), or leave attribution null when the owning router cannot be identified.

Ngôn ngữ chính
TypeScript
Star
0
Fork
0
Merge trung bình
2 giờ 48 phút
Pull request đã merge (30 ngày)
8

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

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

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 usabl-dev/usabl

Tất cả issue của usabl-dev/usabl

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.