Skip to content

Remove json-bigint from the frontend #153

Open

Description

@YanivZalach

Why

The backend now guarantees that no integer above Number.MAX_SAFE_INTEGER reaches the client:

  • backend/graph_normalizer/utils.py:to_json_safe walks the entire /api/v1/graph-data payload and converts any int with abs(value) > 2**53 - 1 to a string.
  • backend/snapshot_map/snapshot_mapping.py already emits snapshot_id as str.
  • GET /api/v1/tables returns only strings.

So json-bigint on the frontend is dead weight: every response can be parsed with the native JSON.

Scope

Remove json-bigint and @types/json-bigint from frontend/package.json and replace every use with native JSON.parse / JSON.stringify:

  • frontend/src/shared/lib/api.ts - jsonWithBigIntsAsStrings for both request stringify and response parse.
  • frontend/src/pages/TableLayout.jsx - graph-data response parse, IndexedDB cache parse, error-body parse.
  • frontend/src/pages/HomePage.jsx - tableHistory localStorage parse.
  • frontend/src/pages/MetadataPage.jsx - parseJsonMaybe for table properties whose value is a JSON string.

Notes

  • MetadataPage's parseJsonMaybe is the one case the backend guard does not cover: it parses arbitrary Iceberg table-property values that are themselves JSON strings, user for it the function in the backend of to_json_safe
  • Do not touch frontend/src/shared/lib/searchParams.ts. It deliberately avoids JSON-parsing URL params so snapshot IDs stay strings; that is unrelated to json-bigint and must stay as is.
  • Snapshot IDs must continue to be treated as strings throughout the UI - this issue removes the big-int parser, not the string-typed IDs.

Done when

  • No json-bigint import remains under frontend/src, and neither package appears in frontend/package.json / package-lock.json.
  • npm run lint, npm run format, npm run typecheck pass.
  • A table with snapshot IDs above 2^53 renders correctly: Home history, snapshot selection, Timeline, Metadata, Graph, and the IndexedDB cache path (reload a previously loaded table).
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions