Skip to content

fix(web): portfolio collect-fees shows authenticate prompt instead of redirecting - #1284

Merged
Mimah97 merged 1 commit into
Vatix-Protocol:mainfrom
Calebux:prmaster/1246-apps-web-portfolio-collect-fees-redirect-284dc2
Oct 18, 2026
Merged

Mimah97 merged 1 commit into
Vatix-Protocol:mainfrom
Calebux:prmaster/1246-apps-web-portfolio-collect-fees-redirect-284dc2

Conversation

@Calebux

@Calebux Calebux commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Closes #1246

Summary

Replaced the silent redirect in handleCollectFees with a state-driven authenticate prompt that reuses the existing handleAuthenticate flow.

Changes to apps/web/app/portfolio/page.tsx:

  • Added pendingCollectPositionId state to track which position triggered the collect action before authentication.
  • Extracted the post-auth collect logic into a doCollectFees callback so both handleCollectFees and handleAuthenticate can invoke it without circular dependencies.
  • handleCollectFees: Instead of router.replace('/') when !authToken, it sets pendingCollectPositionId and returns, keeping the user on the page.
  • handleAuthenticate: After a successful authentication, it checks for a pending collect and calls doCollectFees to proceed automatically.
  • Added a collect-specific authenticate CTA (with message "Authenticate your wallet to collect fees") that appears when pendingCollectPositionId is set. The general authenticate CTA is hidden while the collect-specific one is visible.

Changes to apps/web/__tests__/PortfolioPage.test.tsx:

  • Made the localStorage mock configurable so tests can override it.
  • Added a test that verifies clicking collect without a token shows the authenticate prompt and does not redirect to /.

Opened with PRmaster after human review.

@Mimah97
Mimah97 merged commit 7a6aab0 into Vatix-Protocol:main Oct 18, 2026
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.

apps/web: portfolio collect-fees redirects to home when the auth token is missing instead of prompting to authenticate

2 participants