Closed hakubo closed 9 months ago
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
0 Code Smells
No Coverage information
0.0% Duplication
Hello @hakubo ,
I'm closing this pull request for now, but feel free to reopen it, if you made any progress with it.
set loading to true when we are about to call getValueAsync
Describe the purpose of your pull request
Maybe there is a better way to do this.
Ideally we would get value immediately after user change, but since we are using useEffect here - it usually takes 2 re-renders to get updated value. Meaning there is no way from app perspective to know if we're getting stale value or not.
With setting loading to true - at least app can see that there is loading happening, but that probably introduces a 3 re-render...
in react-query - there are 2 flags for example isLoading when we have no data and have to load it and isFetching when we have data but we're loading new data - so user can decide if they want to use stale data or not.
Ideally though we should decrease number of re-renders IMO.
Related issues (only if applicable)
Provide links to issues relating to this pull request
Requirement checklist (only if applicable)