fix: align invoice-detail fund button with the wallet hook api - #3
Closed
ZuLu0890 wants to merge 1 commit into
Closed
fix: align invoice-detail fund button with the wallet hook api#3ZuLu0890 wants to merge 1 commit into
ZuLu0890 wants to merge 1 commit into
Conversation
- Change FundActions.jsx import from deprecated WalletContext shim to canonical WalletProvider - Add wallet-gating comments on hook aliasing and disabled/prompt-connect flow - Update all 5 test files' mock paths and import paths consistently - Document funding-intent flow in README.md (disconnected/connecting/connected/pending) Closes Liquifact#421
Owner
Author
|
Closing per request — recreating with a new PR |
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.
Problem
The invoice detail page's
FundActionscomponent importeduseWalletandWALLET_STATESfrom the deprecated@/components/WalletContextshim instead of the canonical@/components/WalletProvidersource-of-truth. While the shim re-exports identical references (verified byWalletProvider.consolidation.test.tsx), importing from the canonical path ensures:WalletProvideris mounted (andWalletContextmay eventually be removed), the hook resolves from the active provider.@deprecated Import from @/components/WalletProvider instead.The hook destructuring in
FundActionswas already correct ({ state: walletState, connect }matching the canonical shape{ state, walletData, connect, disconnect }). This PR is a pure import-path alignment plus documentation.Changes
Source
app/invest/[id]/FundActions.jsx@/components/WalletContext→@/components/WalletProviderstate→walletState) and the disabled/prompt-connect/connected/in-flight gating logicWALLET_STATESobject anduseWallet()function are identical references from both pathsTests (5 files)
All mock paths and import paths updated from
@/components/WalletContext→@/components/WalletProvider:app/invest/[id]/page.test.tsxapp/invest/[id]/FundActions.announce.test.tsxapp/invest/[id]/FundActions.optimistic.test.tsxapp/invest/[id]/InvoiceDetailClient.motion-contrast.test.tsxapp/invest/[id]/detail.a11y.test.tsxMock shapes are unchanged — they already returned the canonical
{ state, connect }shape.Documentation
README.md— Added a Funding-intent flow subsection under the Wallet connection section documenting the four wallet-gating states:connect()to prompt wallet connectionFundAmountInputcan be submittedaria-busy="true"What was NOT changed
{ state: walletState, connect }fromuseWallet()isFundingDisabledlogic — unchangedhandleFund— unchanged (still callsconnect()whenDISCONNECTED)handleFundAmount— unchanged (still prompts connect whenDISCONNECTED, submits when connected)aria-labelon Fund button — preserved (detail.fundButtonLabel)Verification
npm run build(Next.js 16.2.12, Turbopack)WalletProvider.consolidation.test.tsx(20 tests)FundActions.announce.test.tsxFundActions.optimistic.test.tsxpage.test.tsxbuildInvoiceDetailItemsundefined inpage.js, jsdom clipboard getter)The 26 failures in
page.test.tsxare pre-existing and unrelated to this PR — they stem frombuildInvoiceDetailItemsbeing called but never defined atpage.js:130, and newer jsdom versions makingnavigator.clipboarda non-configurable getter.Edge cases covered
connect()(notfundInvoice)fundInvoicearia-busy="true", input disabledCloses Liquifact#421