Skip to content

feat(web): auto-refresh projection when background job completes #193

@aaronsb

Description

@aaronsb

Problem

When regenerating projections for large ontologies (≥500 concepts), the API queues a background job and returns immediately. The web client has no indication that it should poll for completion - users must manually refresh the page to see the new projection.

Current Behavior

  1. User clicks regenerate on large ontology
  2. API returns {"status": "queued", "job_id": "..."}
  3. Job completes in 2-5 seconds
  4. Web client shows stale/empty state
  5. User must manually refresh to see results

Desired Behavior

  1. User clicks regenerate
  2. API returns job_id with queued status
  3. Web client shows "Computing projection..." indicator
  4. Client polls job status or projection endpoint
  5. When complete, automatically loads new projection

Implementation Options

  1. Polling: Client polls /projection/{ontology} every 2s until data arrives
  2. Job status polling: Client polls /jobs/{job_id} until completed, then fetches projection
  3. WebSocket/SSE: Push notification when job completes (more complex)

Option 1 (simple polling) is probably sufficient given projections complete in <10s.

Acceptance Criteria

  • Web client detects when projection is queued vs computed
  • Shows loading indicator during computation
  • Automatically refreshes when projection becomes available
  • Stops polling after timeout (30s) with error message

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions