Skip to content

feat: show a pending message while a scrape job polls - #35

Open
nahuel007ng wants to merge 1 commit into
MedMxLabs:mainfrom
nahuel007ng:feat/scrape-pending-state
Open

nahuel007ng wants to merge 1 commit into
MedMxLabs:mainfrom
nahuel007ng:feat/scrape-pending-state

Conversation

@nahuel007ng

Copy link
Copy Markdown

Closes #4

Summary

  • getScraped in frontend/src/services/api.js takes an optional { onPending }, called with { state: 'pending' } on a 202 and with each non-terminal polled job state (for example running). searchMedicines and compareMedicine pass it through via an optional options argument. The 202 -> poll -> replay flow, timeouts and error paths are unchanged.
  • SearchMedicinePage.jsx and MedicineComparisonPage.jsx show "Fetching live prices... this can take up to ~40s" with the job state while polling, and clear it on success, error, unmount or a new request.
  • Why: during a live scrape the UI looked stuck with no explanation. UploadPrescriptionPage.jsx is left out on purpose to keep this PR to the two pages in the issue.

Test plan

  • cd frontend && npm run lint && npm run build (Node 20 as in CI, and Node 22)
  • Manual against a backend returning 202 (not run: no local backend with live scrapers)

Notes

  • No API contract change; existing callers of searchMedicines and compareMedicine keep working without the new argument.
  • No secrets in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

frontend: Show clearer pending state while scrape job polls

1 participant