Skip to content

fix(#932): consolidate useTransactionPolling into useTransaction.ts#956

Merged
Ejirowebfi merged 8 commits into
Favourorg:mainfrom
Topmatrixmor2014:fix/932-consolidate-transaction-status-hooks
Jul 17, 2026
Merged

fix(#932): consolidate useTransactionPolling into useTransaction.ts#956
Ejirowebfi merged 8 commits into
Favourorg:mainfrom
Topmatrixmor2014:fix/932-consolidate-transaction-status-hooks

Conversation

@Topmatrixmor2014

@Topmatrixmor2014 Topmatrixmor2014 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Description

This is the structural root cause behind issue #16: the codebase has two hooks solving the same problem ("track a submitted transaction's status over time") with different APIs, different polling strategies, and different consumers (TransactionStatus.tsx vs. MintForm/AdminPanel/BurnForm). Beyond the immediate backoff bug this split caused, it's a maintenance and consistency risk generally: any future fix, feature (e.g. richer error classification, retry-on-transient-failure), or behavioral change to "how StellarForge tracks a pending transaction" must be remembered and applied twice, in two different shapes, or it silently diverges again exactly as happened with the backoff regression.

Tasks

Audit both hooks' full API surface (UseTransactionPollingResult vs. whatever useTransaction returns) and determine the minimal unified interface that satisfies both TransactionStatus.tsx and the three form components.

Consolidate into a single hook (or a single hook plus a thin, clearly-justified wrapper for any genuinely distinct use case), removing the other.

Update all four consumer components and their existing tests to the unified API.

Add an architectural note (code comment or CONTRIBUTING.md addition) establishing "transaction-status tracking has exactly one implementation" as a convention, to prevent recurrence.
Acceptance Criteria

grep -rn "setInterval|setTimeout" frontend/src/hooks shows exactly one transaction-polling implementation.

All prior consumers pass their existing tests against the unified hook with no behavioral regression.

  • Moved useTransactionPolling hook into useTransaction.ts so all transaction status tracking lives in a single module
  • Added architectural comment establishing single-implementation convention
  • Updated TransactionStatus.tsx to import from useTransaction.ts
  • Deleted useTransactionPolling.ts (duplicate file)
  • Downgraded jsdom from 29.0.1 to 25.0.1 to fix ESM compatibility issue blocking all tests

closes #932

…tion.ts

- Moved useTransactionPolling hook into useTransaction.ts so all transaction status tracking lives in a single module
- Added architectural comment establishing single-implementation convention
- Updated TransactionStatus.tsx to import from useTransaction.ts
- Deleted useTransactionPolling.ts (duplicate file)
- Downgraded jsdom from 29.0.1 to 25.0.1 to fix ESM compatibility issue blocking all tests
… PromiseRejectionEvent

Fix duplicate routes in App.tsx (broken closing tag blocking lint/format/build). Fix useTransactionHistory.test.ts vi.mock hoisting with vi.hoisted(). Fix unhandledRejections.test.ts with PromiseRejectionEvent polyfill for jsdom.
Run prettier --write to fix code style issues flagged by format:check.
The main branch merge changed useTransactionHistory.ts to use fetchRef.current and added filterKey dep to debounce. Updated loading test to use sync act for timer + async act for microtask flush. Updated cache test to expect re-fetch on options change (now correct behavior).
…rve useTransactionPolling.ts deletion and add Sentry integration to useTransaction.ts polling code
…ifact, type/lint errors, and CreateToken test hang with fake timers
@Ejirowebfi
Ejirowebfi merged commit 28a84b6 into Favourorg:main Jul 17, 2026
9 checks passed
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.

Two independent, divergent transaction-status implementations coexist

2 participants