suddjian edited a comment on pull request #13218:
URL: https://github.com/apache/superset/pull/13218#issuecomment-781712801


   @ktmud At first I did consider an approach like your `useAsyncData` example, 
but I found that there was more that could be done when using a url as a 
resource identifier instead of passing in an anonymous promise. This may not be 
obvious right now, since the hook doesn't yet have any extra bells and whistles 
attached, but this interface will allow us to add on some cool functionality 
later. Things like de-duplicating requests between components, utilizing local 
storage, caching results, streaming updates from the server or changes from 
elsewhere in the app, all without callers of the `useApiResource` hooks needing 
to change anything about their usage.
   
   That's also why I opted not to use the `processResponse` param. I wanted to 
keep the core api fetching hook as single-minded as possible, and treat the 
transformation as a sort of composed view of that data.
   
   I do wonder if those cool future add-ons might be better implemented inside 
the guts of `makeApi`, though 🤔 


----------------------------------------------------------------
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]

Reply via email to