Refactor FileTree read-only workspace categorization to a single flag
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
- 52/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Read lua-learning-website/src/hooks/compositeFileSystemAdapter.ts and fileSystemTypes.ts first to trace TreeNode construction and the workspace flags. Then inspect FileTree.tsx and filterWritableFolders.ts for the duplicated categorization checks. Done means all listed workspace types remain in the correct sections, with related unit tests, examples-workspace.spec.ts, equivalent demos e2e tests, and mutation testing passing.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Background
In FileTree.tsx, the categorization of workspaces into "regular" (editable) vs "readOnly" sections uses a hardcoded OR chain of per-type flags:
```ts
if (node.isLibraryWorkspace || node.isDocsWorkspace || node.isBookWorkspace
|| node.isExamplesWorkspace || node.isProjectsWorkspace || node.isDemosWorkspace) {
readOnly.push(node)
} else {
regular.push(node)
}
```
The same pattern is duplicated in src/components/AnsiGraphicsEditor/filterWritableFolders.ts:
```ts
return !!(node.isReadOnly || node.isLibraryWorkspace || node.isDocsWorkspace
|| node.isBookWorkspace || node.isExamplesWorkspace || node.isDemosWorkspace)
```
Every new read-only workspace type (library, docs, book, examples, projects, demos, ...) requires touching these OR chains. This is brittle and easy to forget — PR #751 demonstrated the failure mode: forgetting to plumb isDemosWorkspace caused ~40 e2e tests to fail because demos landed in the wrong tree section.
Proposal
Introduce a single node.isReadOnlyWorkspace (or reuse the existing node.isReadOnly for root-level workspace folders only) set once in buildTreeFromFileSystem based on workspace.isReadOnly === true. Collapse both OR chains to a single flag check.
```ts
// FileTree.tsx
if (node.isReadOnlyWorkspace) {
readOnly.push(node)
} else {
regular.push(node)
}
```
Files
lua-learning-website/src/hooks/compositeFileSystemAdapter.ts— set new flaglua-learning-website/src/hooks/fileSystemTypes.ts— add toTreeNodelua-learning-website/src/components/FileTree/FileTree.tsx— collapse OR chainlua-learning-website/src/components/AnsiGraphicsEditor/filterWritableFolders.ts— collapse OR chain- Related tests
Verification
- Unit tests for each workspace type (library, docs, book, examples, projects, demos) continue to land in the correct section
examples-workspace.spec.tsand equivalent demos e2e still pass- Mutation testing on the changed categorization logic
Risk / Scope
Medium. Affects all read-only workspace rendering paths. Needs a careful mutation-test pass since this is categorization logic that's load-bearing for file tree UX and test infrastructure.
Deferred from #751 per reviewer feedback as out-of-scope tech debt.
- Ngôn ngữ chính
- TypeScript
- Star
- 1
- Fork
- 0
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của jcollard/LuaInTheWeb
-
tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
jcollard/LuaInTheWeb#752 ·
-
tech-debt
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
jcollard/LuaInTheWeb#690 ·
-
tech-debt
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
jcollard/LuaInTheWeb#590 ·
-
tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
jcollard/LuaInTheWeb#518 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
jcollard/LuaInTheWeb#235 ·
Tất cả issue của jcollard/LuaInTheWeb
Issue tương tự
-
bug require-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
expressjs/expressjs.com#2549 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
umami-software/umami#4686 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: Device screenshot fails with 500 on iPhone Duo (Xcode 27.2): serve-sim calls simctl without --displayCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
pingdotgg/t3code#24900 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
inu-appcenter/UNIDorm-web#411 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày