babylonchain / simple-staking

Simple staking application
Other
4 stars 13 forks source link

stakingFeeSat callback #259

Open gbarkhatov opened 3 months ago

gbarkhatov commented 3 months ago

Currently stakingFeeSat is a memoized function. @jrwbabylonchain suggested we have a callback function

@jrwbabylonchain please add the details of:

jrwbabylonlab commented 3 months ago

What it will improve

Avoid the react re-rending issue. as explained here https://github.com/babylonchain/simple-staking-private/pull/252#discussion_r1640881580

I have put a console.log("rerended") inside the stakingFee.tsx. When i hit the button to adjust the fee. i have this log printed 8 times in total. so 8 re-render. Imaging if we have a api call here, then this would be an issue.

Your suggestion about the function

Highlighted here with examples: https://github.com/babylonchain/simple-staking-private/pull/252#discussion_r1640979609