chatch / stellarexplorer

Ledger Explorer for the Stellar Network πŸš€
https://steexp.com
Apache License 2.0
455 stars 1.06k forks source link

fix second arg of useEffect #578

Closed jp-ryuji closed 9 months ago

jp-ryuji commented 9 months ago

PR to fix this issue:

https://github.com/chatch/stellarexplorer/issues/577

Problem (and fix):

The second argument of useEffect was not correctly defined. So the code in useEffect was executed on every rendering. The variables including the functions used in useEffect should be defined in the second argument. Then the code in useEffect is executed on the first rendering and when the variables are changed, which is the correct behavior.

What the title looks like with this change (for example):

γ‚Ήγ‚―γƒͺγƒΌγƒ³γ‚·γƒ§γƒƒγƒˆ 2024-01-04 15 16 27