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

未关闭
#40 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
50/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
技术栈
react, typescript, vite

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.
主要语言
Python
星标
1
派生
1
平均合并
4 小时 46 分钟
30 天内合并 PR
55

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

falbany/ProFiles 的其他 Issue

查看 falbany/ProFiles 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。