[BUG] useEscrow() hook re-fetches on every render when passed a new but structurally-identical options object

Open Beginner friendly
#1,002 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
63/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
react, typescript
Domain
frontend

Research direction

Start at the useEscrow hook and inspect its useEffect dependency array, which the issue identifies as containing the raw options object. Reproduce with an inline options object and unrelated re-renders, then check the network requests. Done when unchanged options no longer trigger repeated fetches; the issue does not name a test file.

Written by the indexing model from the issue text.

Description

bug difficulty: easy good first issue priority: medium sdk

Description

useEscrow(escrowId, options) includes the options object directly in its internal useEffect dependency array; a caller that constructs a new (but structurally identical) options object on every render — an easy and common mistake — triggers a full re-fetch on every single render instead of only when the escrow ID or options actually change.

Component

hooks

Steps to Reproduce

  1. Use useEscrow(escrowId, { includeHistory: true }) with the options object literal inline in the render function.
  2. Trigger a few unrelated re-renders of the component.
  3. Monitor network requests.

Expected Behavior

The hook should compare options by value (or require/encourage memoization) rather than by reference, to avoid this very easy-to-hit footgun.

Actual Behavior

An extremely natural, common calling pattern causes excessive, unnecessary re-fetching on every render.

Environment

  • SDK version: 0.3.x
  • Node version: 20.x, 22.x
  • OS: macOS / Linux
  • Network: TESTNET

Code Example

const { escrow } = useEscrow(escrowId, { includeHistory: true });

Error Output

N/A — no thrown error; behavior is incorrect but silent.

Difficulty

🟢 Easy

Additional Context

The useEffect dependency array includes the raw options object reference rather than a deep-compared or destructured set of primitive dependencies.

Dominant language
TypeScript
Stars
0
Forks
73
Avg merge
6h 26m
Merged PRs (30d)
37

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from trustflow-protocol/trustflow-sdk

All issues in trustflow-protocol/trustflow-sdk

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.