Skip to content

fix(escrow): periodically re-evaluate unlock time and auto-refresh escrow list (#40) - #90

Open
ghzhost wants to merge 1 commit into
StellarSend:mainfrom
ghzhost:fix/escrow-unlock-timer-re-evaluate
Open

fix(escrow): periodically re-evaluate unlock time and auto-refresh escrow list (#40)#90
ghzhost wants to merge 1 commit into
StellarSend:mainfrom
ghzhost:fix/escrow-unlock-timer-re-evaluate

Conversation

@ghzhost

@ghzhost ghzhost commented Sep 2, 2026

Copy link
Copy Markdown

Summary

Closes #40

Problem

  • EscrowItem evaluates getEscrowPermissions and unlocked against a freshly constructed Date at render time, but EscrowList had no interval or timer to re-render as real time passes.
  • Depositors viewing an open escrow whose unlock time arrived while they remained on the page would see the "Refund" button stay hidden and "Refund available after unlock" remain indefinitely until an unrelated state change forced a remount.
  • Furthermore, useEscrowList lacked a refetchInterval, unlike other query hooks in the app.

Solution

  • Added a 10-second timer (setInterval) in EscrowList managing local now state, which is threaded to EscrowItem(now={now}) to ensure permissions and unlock status automatically update as time passes.
  • Added refetchInterval: 30_000 to useEscrowList query config so backend state changes (e.g. status updates or remote releases) are periodically fetched in the background.
  • Added a regression test in EscrowList.test.tsx verifying that advancing fake timers past an escrow's unlockTime automatically surfaces the Refund button.

Testing

  • npm test passing cleanly across all suites (EscrowList.test.tsx, EscrowItem.test.tsx, useEscrows.test.tsx, etc.).
  • npm run build cleanly bundled.

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.

EscrowItem/EscrowList never re-evaluate unlock time as it passes — the Refund button can stay hidden long after the real unlock time

1 participant