Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ test-results/
playwright-report/
blob-report/
playwright/.cache/

# Storybook
storybook-static/
196 changes: 0 additions & 196 deletions app/hooks/useRecentLedgers.ts

This file was deleted.

26 changes: 26 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Documentation Index

This directory holds the current, canonical documentation for the project.
Each topic has exactly one current document. If you are looking for a topic
that used to live at the repository root, it has been consolidated here.

## Topics

| Topic | Document |
| --- | --- |
| Testing strategy and how to run tests | [TESTING.md](./TESTING.md) |
| Transaction history (feature, design, and implementation) | [TRANSACTION_HISTORY.md](./TRANSACTION_HISTORY.md) |
| Performance notes | [PERFORMANCE.md](./PERFORMANCE.md) |

## Archive

Documents that described work already merged, or that have been superseded by
the consolidated documents above, live under [`archive/`](./archive/). They are
kept for historical reference only and are **not** current.

- `archive/SIMULATION_IMPLEMENTATION_CHECKLIST.md`
- `archive/REACT_QUERY_RECENT_LEDGERS.md`
- `archive/TRANSACTION_HISTORY_DELIVERY.md`
- `archive/TRANSACTION_HISTORY_DOCUMENTATION.md`
- `archive/TRANSACTION_HISTORY_IMPLEMENTATION.md`
- `archive/TESTING_STRATEGY.md`
64 changes: 64 additions & 0 deletions docs/TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Testing

This is the single current testing document for the project. It replaces the
former root-level `TESTING.md` and `TESTING_STRATEGY.md`, which described the
same testing approach in two overlapping files.

## Goals

- Catch regressions before they reach `main`.
- Keep tests fast enough to run on every change.
- Cover the critical paths: ledger ingestion, transaction history, and the
simulation flow.

## Test layers

### Unit tests

Small, fast, and isolated. They cover pure logic such as formatting helpers,
parsers, and reducers. Prefer these whenever the behavior can be exercised
without a network or a database.

### Integration tests

Exercise modules together against a test database or mocked services. Use these
for data access, query hooks, and anything that crosses a module boundary.

### End-to-end tests

Drive the application the way a user would. Keep the suite small and focused on
flows that must never break, such as loading recent ledgers and viewing a
transaction's history.

## Running the tests

```sh
# all tests
npm test

# a single file
npm test -- path/to/file.test.ts

# watch mode during development
npm test -- --watch
```

## Conventions

- Place tests next to the code they cover, using the `*.test.ts` suffix.
- Name tests after the behavior under test, not the implementation.
- Avoid snapshot tests for anything that changes often.
- Mock external services at the boundary; do not reach into their internals.
- Keep each test independent — no shared mutable state between cases.

## What to test

- New behavior: add a test that fails without the change.
- Bug fixes: add a regression test that reproduces the original bug.
- Refactors: rely on existing tests; add coverage only for newly exposed paths.

## Continuous integration

The full suite runs on every pull request. A change is not ready to merge until
the suite passes. Flaky tests should be fixed or removed rather than retried
indefinitely.
40 changes: 40 additions & 0 deletions docs/TRANSACTION_HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Transaction History

This is the single current document describing the transaction-history feature.
It consolidates the former root-level `TRANSACTION_HISTORY_DELIVERY.md`,
`TRANSACTION_HISTORY_DOCUMENTATION.md`, and
`TRANSACTION_HISTORY_IMPLEMENTATION.md`, which are now superseded.

## Overview

The transaction-history feature lets a user browse the transactions associated
with their account. It is backed by the recent-ledgers data layer and rendered
through the transaction-history UI.

## Data layer

- Recent ledgers are fetched with the `useRecentLedgers` hook, which wraps the
React Query cache and exposes loading, error, and data states to consumers.
- The hook is the single source of truth for ledger data; UI components should
consume it rather than fetching ledgers directly.
- Query keys and cache invalidation live alongside the hook so that refetches
stay consistent across the app.

## UI

- The transaction-history view renders the ledgers returned by
`useRecentLedgers`, handling the loading and empty states.
- Each entry links to its transaction detail where applicable.

## Delivery notes

The feature has been merged. The per-delivery documents that tracked its
implementation (`TRANSACTION_HISTORY_DELIVERY.md`,
`TRANSACTION_HISTORY_DOCUMENTATION.md`,
`TRANSACTION_HISTORY_IMPLEMENTATION.md`) have been consolidated into this file
and removed from the repository root.

## See also

- [Documentation index](./README.md)
- [Testing](./TESTING.md)
5 changes: 5 additions & 0 deletions src/hooks/useRecentLedgers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export interface UseRecentLedgersResult {
* Recent Stellar ledgers for `network`, cached and deduplicated by React
* Query instead of the previous `useEffect` + local `useState` fetch.
*
* This is the single canonical implementation of `useRecentLedgers` for the
* app. The former duplicate under `app/hooks/useRecentLedgers.ts` has been
* removed (see #585); every importer must resolve to this module so caching,
* polling, and error behaviour stay consistent across the codebase.
*
* `refresh()` is a `useMutation`, not a plain `refetch()` call, specifically
* to get optimistic-update semantics: clicking refresh flips `isRefreshing`
* true synchronously (before the network round-trip resolves) so the UI can
Expand Down