Skip to content

feat(ProofOfHeart-frontend): performance-uselivecampaignfunding-polls-every-n - #705

Merged
davidmaronio merged 2 commits into
Iris-IV:mainfrom
Caneryy:feat/issue-571
Aug 4, 2026
Merged

feat(ProofOfHeart-frontend): performance-uselivecampaignfunding-polls-every-n#705
davidmaronio merged 2 commits into
Iris-IV:mainfrom
Caneryy:feat/issue-571

Conversation

@Caneryy

@Caneryy Caneryy commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Closes #571

Summary

Replaces useLiveCampaignFunding polling with Soroban contribution_made event streaming via the existing sorobanEvents.ts infrastructure.

Changes

  • useLiveCampaignFunding — no more setInterval polling; live amount updates from streamed events, reconciled on get_campaign refetch
  • useCampaignContributionEvents — subscribes to contribution_made with cursor-based streaming, deduplication by event id, pauses when tab is hidden
  • sorobanEvents.ts — extended with subscribeContributionMadeEvents and contribution amount helpers
  • Tests — coverage for event parsing and subscription logic

Rebase note (per @davidmaronio review)

Rebased onto latest main to clear stale lint failures from files this PR does not touch. Lint and format checks now pass on the rebased branch.

Acceptance criteria

  • Polling replaced with Soroban event streaming
  • Uses existing sorobanEvents.ts infrastructure
  • Event deduplication on reconnect
  • Reconciliation via get_campaign refetch still works
  • Lint + Prettier pass after rebase onto main

Test plan

  • npm run lint — 0 errors
  • npm run format:check — passes
  • sorobanEvents.test.ts unit tests pass
  • Manual: campaign detail page shows live funding increments without polling

Known CI status

Playwright E2E remains red — confirmed upstream shared issue, not introduced by this PR (@davidmaronio).

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@Caneryy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@sshdopey

Copy link
Copy Markdown
Contributor

Auto-review failed (API error). Leaving PR for human review.

@Caneryy

Caneryy commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@davidmaronio review and merge please

@davidmaronio

Copy link
Copy Markdown
Contributor

the live-campaign-funding polling refactor looks clean and doesn't introduce any lint hits of its own, the lint failure is stale, it's flagging warnings in files you don't touch because the branch predates their fixes on main. rebase onto main and lint clears; after that the only red is our shared broken Playwright e2e.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sshdopey

sshdopey commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Auto-review failed (API error). Leaving PR for human review.

1 similar comment
@sshdopey

sshdopey commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Auto-review failed (API error). Leaving PR for human review.

@Caneryy

Caneryy commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

All checks passed now. please review and merge @davidmaronio

@davidmaronio davidmaronio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice migration: the cursor-based subscribeContributionMadeEvents with backoff on errors, immediate re-poll on full batches, dedup by event id, and the visibility gate in the hook are all solid, and the tests cover the streaming loop and unsubscribe path. CI is green and the branch is clean.

two small notes:

  1. src/lib/sorobanEvents.ts:145: the default idle interval drops from the previous 5s poll to 2s, which increases rpc load when nothing is happening. the env override still works, but consider keeping 5s as the idle default since this PR is billed as a performance win.
  2. heads up that #849 migrates this same hook onto the shared eventSubscriber. whichever lands second will need a rebase; flagging so the authors can coordinate.

@davidmaronio
davidmaronio merged commit f1e3792 into Iris-IV:main Aug 4, 2026
15 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.

[Performance] useLiveCampaignFunding polls every N seconds — migrate to Soroban event streaming

3 participants