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

Abierto
#40 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
50/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
react, typescript, vite

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
Python
Estrellas
1
Forks
1
Merge medio
4 h 46 min
PR fusionados (30 d)
55

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de falbany/ProFiles

Todos los issues de falbany/ProFiles

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.