feat(wallet): subscribe to Freighter network changes, poll 5s fallback, disable Execute on wrong network (#42)#261
Conversation
|
@collinsezedike is attempting to deploy a commit to the ezedikeevan's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@collinsezedike 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! 🚀 |
ezedike-evan
left a comment
There was a problem hiding this comment.
Code quality is solid — the lazy dynamic import of `WatchWalletChanges` correctly eliminates the SSR crash, the 5s polling fallback is clean with proper cleanup, and `executeDisabled={network !== 'PUBLIC'}` in the rate table is the right place for that guard. The test mock upgrade in `useFreighter.spec.tsx` is a real improvement over the stub.
One thing to fix before this can land: this branch has a merge conflict with `main`. Please rebase on `main` and resolve any conflicts, then push — I'll merge immediately after.
```bash
git fetch origin
git rebase origin/main
resolve any conflicts, then:
git push --force-with-lease
```
Note: PR #262 (mid-session install detection) is stacked on top of this branch. Rebase this one first, then rebase #262 on top of the updated branch.
|
Approved and ready to land. Sole remaining blocker is the merge conflict — please rebase and push: ```bash resolve any conflicts, then:git push --force-with-lease Once this is merged, ping here so I can trigger the rebase on #262 (which is stacked on top of this branch). |
…k, disable Execute on wrong network (ezedike-evan#42)
7a8dcb3 to
5089960
Compare
| import { renderHook, waitFor } from '@testing-library/react'; | ||
| import { useFreighter } from '@/hooks/useFreighter'; | ||
| import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest' | ||
| import { render, renderHook, waitFor } from '@testing-library/react' |
Summary
useFreighter: replaced 300ms polling withWatchWalletChangessubscription (5s interval); falls back to 5ssetIntervalpolling if the API is unavailableWalletContext: same subscription pattern via lazy dynamic import (avoids SSR failures from a static top-level import); single cleanup covers both pathsWalletButton: consumesuseWalletfrom context so the wrong-network badge re-renders reactively on network switchRateTable: acceptsexecuteDisabledprop; Execute button is disabled whenever the app network is notPUBLICTest plan
Closes #42