pancakeswap / pancake-frontend

:pancakes: Pancake main features (farms, pools, IFO, lottery, profiles)
https://pancakeswap.finance
GNU General Public License v3.0
2.7k stars 3.56k forks source link

fix: Updated functional props cannot rerender modal causes modal to not work properly #10966

Open memoyil opened 6 days ago

memoyil commented 6 days ago

To reproduce:

Go to v3 increase liquidity Click increase after selecting token amounts See increase button not working

Root cause:

Deadline variable at the time modal rendered not yet available therefore it causes onIncrease return without calling the tx. Even the deadline variable (which needs blocktimestamp rpc call to return) ready after some seconds modal cannot be updated due to functional props stringify is as same as old one.


PR-Codex overview

This PR focuses on optimizing several components by using useCallback to memoize functions, which helps prevent unnecessary re-renders in React applications. This improves performance and maintains the stability of function references.

Detailed summary

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

changeset-bot[bot] commented 6 days ago

⚠️ No Changeset found

Latest commit: 1ef39867b2c13409f827ea8f193add6fcee1a5b7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

vercel[bot] commented 6 days ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
aptos-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 25, 2024 8:15am
blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 25, 2024 8:15am
bridge ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 25, 2024 8:15am
games ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 25, 2024 8:15am
gamification ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 25, 2024 8:15am
uikit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 25, 2024 8:15am
web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 25, 2024 8:15am