Skip to content

feat: reduce useEffect usage#1120

Merged
0xeye merged 5 commits intorelease/04-01-26from
feat/reduce-effects
Mar 20, 2026
Merged

feat: reduce useEffect usage#1120
0xeye merged 5 commits intorelease/04-01-26from
feat/reduce-effects

Conversation

@0xeye
Copy link
Collaborator

@0xeye 0xeye commented Mar 18, 2026

Based on:
https://react.dev/learn/you-might-not-need-an-effect
https://x.com/alvinsng/status/2033969062834045089

We often hit render loops, usually useEffect is the culprit. We should reduce where possible imo, I think it's good practise

Test:

  • Run through app, ensure all working as intended

@0xeye 0xeye requested a review from rossgalloway March 18, 2026 09:11
@vercel
Copy link

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
yearnfi Ready Ready Preview, Comment Mar 20, 2026 2:20pm

Request Review

@github-actions
Copy link

github-actions bot commented Mar 18, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@rossgalloway
Copy link
Collaborator

rossgalloway commented Mar 19, 2026

Review findings:

  1. [P2] Re-require deposit slippage confirmation after any quote change
    This now remembers the user's high-price-impact acknowledgement by priceImpactAcceptanceKey instead of clearing it whenever the quote changes. If someone checks the box for a risky deposit, changes the amount/token so a different quote is shown, and then returns to the original quote, hasAcceptedPriceImpact becomes true again and the deposit CTA is re-enabled without a fresh acknowledgement. That weakens the warning gate compared with the previous boolean-reset behavior.

  2. [P2] Re-require withdraw slippage confirmation after any quote change
    This makes the withdraw warning sticky for any previously accepted priceImpactAcceptanceKey. A user can acknowledge a high-impact withdrawal, change inputs so the warning disappears or a different quote is shown, and then come back to the original risky quote with the checkbox already satisfied and the CTA enabled. The prior implementation forced a new acknowledgement after any intermediate quote change, which is the safer behavior for a slippage warning.

Fix PR: #1124

Replace remembered confirmation keys with keyed resettable state in the deposit and withdraw widgets.

This preserves the high-price-impact warning behavior without reintroducing a reset effect, so a user returning from quote B back to quote A must acknowledge the warning again.
@0xeye 0xeye merged commit 50b4019 into release/04-01-26 Mar 20, 2026
7 checks passed
@0xeye 0xeye deleted the feat/reduce-effects branch March 20, 2026 14:21
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.

2 participants