Web: dead API-client functions, stale PWA config, and a centralized requestJson helper for client.ts

Đang mở
#40 0 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
50/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, typescript, vite
Lĩnh vực
build-system, frontend

Hướng nghiên cứu

Start in api/client.ts to see the 25 fetch wrappers and dead functions at the listed lines. Read vite.config.ts for the broken PWA asset refs and App.tsx/StatusBar.tsx for vestigial state. Create a requestJson helper and route all calls through it, delete or wire dead code, import types from api/types.ts, and replace any catches. Done when no raw fetch remains, manifest icons exist, and TypeScript shows zero any.

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

Mô tả

code-quality frontend

Dead code (zero callers)

  • launchWithArgs — api/client.ts:222-230. The "Launch with arguments" flow routes through handleLaunch; either wire it up or delete (the /api/actions/launch-with-args endpoint is likewise unused by the UI).
  • fetchWorkflowSession — client.ts:320-324. The runner modal is purely request-driven; if the backend hangs, the modal shows "Step in progress…" forever with no buttons for status running (WorkflowRunnerModal.tsx:460-521). Either delete it or use it to poll running sessions (which would also give hang recovery — complements #24).
  • Vestigial language state — StatusBar.tsx:140-166 toggle + App.tsx:93, 1440-1441 changes nothing (see the i18n issue).
  • vite.config.ts:25-48 — PWA config references public/favicon.ico, robots.txt, /icon-192.png, /icon-512.png that don't exist (public/ has only favicon.svg), so the manifest ships broken icon refs; a service worker inside a localhost webview only causes the stale-asset problems web/README documents. Drop VitePWA from the webview build or fix the assets. The @ alias (:50-54) is unused.

client.ts hardening (25 near-identical fetch wrappers)

  • Only 3 of 25 functions extract FastAPI's detail (loadConfigContent, reloadConfig, startWorkflowSession); the rest throw generic strings and hide the server's reason.
  • Unguarded res.json() everywhere — a proxy 502 HTML page surfaces as "Unexpected token '<'…".
  • No timeouts/AbortController on non-scan calls — a hung backend leaves e.g. hash computation silent after the toast expires and the workflow modal stuck.

Fix: one requestJson helper (method/headers/ok-check/detail extraction/AbortSignal.timeout) that all 25 delegate to.

  • Raw fetch bypasses the client: handleClearFile (App.tsx:892-904, discards server detail), DirectoryPickerModal.tsx:63 (duplicates client.browseDirectory).

Type hygiene

  • 38 any occurrences (33 are catch (err: any)) → err instanceof Error ? err.message : String(err) helper.
  • DirectoryPickerModal.tsx:13-23 redefines BrowseEntry/BrowseResult already exported from api/types.ts — import instead.
  • client.ts:251-263 generateBarcode keeps a filePath/file_path compat shim; all callers pass filePath — drop the shim.
Ngôn ngữ chính
Python
Star
1
Fork
1
Merge trung bình
4 giờ 46 phút
Pull request đã merge (30 ngày)
55

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 falbany/ProFiles

Tất cả issue của falbany/ProFiles

Issue tương tự

Thêm issue về Python

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.