Skip to content

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

Open

Description

@falbany

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 Web GUI: closing the workflow runner modal mid-workflow leaves the session hanging — wire abort-on-close and session cleanup #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.

Activity

  1. added
    code-quality
    frontend
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    code-qualityfrontend

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions