ethereum / remix-project

Remix is a browser-based compiler and IDE that enables users to build Ethereum contracts with Solidity language and to debug transactions.
https://remix-ide.readthedocs.io
MIT License
2.38k stars 900 forks source link

Optimizations to Etherscan react code #3915

Open joeizang opened 1 year ago

joeizang commented 1 year ago

Even though this is merged, I think it's worth noting that the code marked might need to be refactored and optimized. When you have a function inside of a react component and you use it inside of a useEffect, that function refrence will be created everytime and closures will be created everytime which could bring performance penalties that are unwanted. Solution would be to wrap your function inside of a useCallback which basically memoizes the function and its references so that react doesn't need to recreate anything if the function itself doesn't actually change. Function name is updateConsFields and code in question is from line 55 - 70 in VerifyVIew.tsx

fwx5618177 commented 1 year ago

@joeizang @Aniket-Engg Have solved it.

Here is PR: https://github.com/ethereum/remix-project/pull/3945