suddjian opened a new pull request #13218: URL: https://github.com/apache/superset/pull/13218
### SUMMARY <!--- Describe the change below, including rationale and design decisions --> This introduces a new hook `useApiV1Resource`, which I want to put forward as an example of a new state management pattern. This lets a functional component fetch arbitrary api data with just a couple lines of code, with the entire async request lifecycle and component lifecycle taken care of. For now it uses local state, but we can change it to use any other form of storage without changing how the hook is called. As a micro-POC, I've used the hook to refactor some code to lazy load chart owners instead of depending on bootstrap data. This will save quite a few joins in future stages of the Single Page App project. ### TEST PLAN <!--- What steps should be taken to verify the changes --> Unit tests to be written before merge - seeking feedback on hook design first. ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [ ] Has associated issue: - [ ] Changes UI - [ ] Requires DB Migration. - [ ] Confirm DB Migration upgrade and downgrade tested. - [ ] Introduces new feature or API - [ ] Removes existing feature or API ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
