Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Add context hooks for metrics and sample manifest #1

Description

@owtaylor

It's inefficient that the metrics and sample manifest are reloaded every time the user navigates to those pages - we really should be able to just load them once when the page is loaded.

To fix this, move web/src/utils/fetchMetrics to web/src/context/Metrics.tsx and make it export:

  • A hook 'useMetrics' that retrieves the metrics (or undefined before they are loaded)
  • A component MetricsProvider

Similarly, extract the sample manifest reading code from web/src/components/Samples.tsx to web/src/context/SampleManifest.tsx and make it export useSampleManifest() and SampleManifestProvider.

Then use these in App.tsx so that all the pages have access to the context, and modify page components appropriately.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions