fix(#932): consolidate useTransactionPolling into useTransaction.ts#956
Merged
Ejirowebfi merged 8 commits intoJul 17, 2026
Conversation
…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
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
closes #932