Skip to content

Fix trajectory fetch error handling and add loading/error UI - #219

Open
meganrm wants to merge 1 commit into
mainfrom
fix/trajectory-error-state
Open

Fix trajectory fetch error handling and add loading/error UI#219
meganrm wants to merge 1 commit into
mainfrom
fix/trajectory-error-state

Conversation

@meganrm

@meganrm meganrm commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Problem

Estimated review size: medium

fetch3DTrajectory's catch block only did console.log(error) and never reported failure to the caller, so App.tsx unconditionally set trajectoryStatus to LOADED even after a failed fetch. Separately, nothing in the app ever rendered UI based on trajectoryStatus at all — a loading or failed fetch just left the viewer blank with no feedback.

Fixes #223

Solution

fetch3DTrajectory now returns a success boolean instead of swallowing errors. App.tsx sets TrajectoryStatus.ERROR on failure instead of always LOADED. trajectoryStatus is now exposed through SimulariumSimulationContext so Viewer.tsx can consume it, and shows a loading spinner while fetching and an error message + retry button on failure (retry resets status to INITIAL, re-entering the existing fetch effect).

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Change summary:

  • fetch3DTrajectory returns a success boolean instead of swallowing errors
  • App.tsx sets TrajectoryStatus.ERROR on failure instead of always LOADED
  • trajectoryStatus/setTrajectoryStatus exposed through SimulariumSimulationContext
  • Viewer.tsx shows a loading spinner while fetching and an error message + retry button on failure

Steps to Verify:

  1. Navigate to a page with a precomputed trajectory
  2. Confirm a loading spinner appears while it fetches
  3. Temporarily point a trajectory URL at a broken/404 URL
  4. Confirm an error message + retry button appear instead of a blank screen
  5. Click retry — confirm it re-attempts the fetch

Screenshots (optional):

Keyfiles (delete if not relevant):

  1. src/utils/fetch3DTrajectory.ts
  2. src/App.tsx
  3. src/components/Viewer.tsx
  4. src/simulation/context.tsx

Thanks for contributing!

…ding/error UI (UX1)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@meganrm
meganrm requested a review from a team as a code owner August 11, 2026 23:54
@meganrm
meganrm requested review from interim17 and tyler-foster and removed request for a team August 11, 2026 23:54
@meganrm
meganrm marked this pull request as draft August 12, 2026 17:44
@meganrm
meganrm marked this pull request as ready for review August 12, 2026 20:49
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.

Trajectory fetch errors are silently discarded — no loading/error UI shown

1 participant